diff options
author | Jeff Layton <jlayton@kernel.org> | 2021-08-31 13:39:13 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2021-11-08 03:29:51 +0100 |
commit | 5d6451b1489ad1781a0778cc876bf26a21910413 (patch) | |
tree | 57009050cfeab77b517d5a6cfcba388aa824e7ca /fs/ceph/locks.c | |
parent | 36e6da987e7ea839c671c950da5d3a6d175b3f0d (diff) | |
download | linux-5d6451b1489ad1781a0778cc876bf26a21910413.tar.bz2 |
ceph: shut down access to inode when async create fails
Add proper error handling for when an async create fails. The inode
never existed, so any dirty caps or data are now toast. We already
d_drop the dentry in that case, but the now-stale inode may still be
around. We want to shut down access to these inodes, and ensure that
they can't harbor any more dirty data, which can cause problems at
umount time.
When this occurs, flag such inodes as being SHUTDOWN, and trash any caps
and cap flushes that may be in flight for them, and invalidate the
pagecache for the inode. Add a new helper that can check whether an
inode or an entire mount is now shut down, and call it instead of
accessing the mount_state directly in places where we test that now.
URL: https://tracker.ceph.com/issues/51279
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/locks.c')
-rw-r--r-- | fs/ceph/locks.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index bdeb271f47d9..74c227d9abf5 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -241,6 +241,9 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) if (!(fl->fl_flags & FL_POSIX)) return -ENOLCK; + if (ceph_inode_is_shutdown(inode)) + return -ESTALE; + dout("ceph_lock, fl_owner: %p\n", fl->fl_owner); /* set wait bit as appropriate, then make command as Ceph expects it*/ @@ -306,6 +309,9 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) if (fl->fl_type & LOCK_MAND) return -EOPNOTSUPP; + if (ceph_inode_is_shutdown(inode)) + return -ESTALE; + dout("ceph_flock, fl_file: %p\n", fl->fl_file); spin_lock(&ci->i_ceph_lock); |