From: Yan, Zheng Date: Wed, 4 Mar 2020 13:22:20 +0000 (+0800) Subject: ceph: update dentry lease for async create X-Git-Tag: v5.7-rc1~39^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3313f66a57ed73a47162af642e2c8d3995cae058;p=thirdparty%2Fkernel%2Flinux.git ceph: update dentry lease for async create Otherwise ceph_d_delete() may return 1 for the dentry, which makes dput() prune the dentry and clear parent dir's complete flag. Signed-off-by: "Yan, Zheng" Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov --- diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 67080721cec8e..a6c484123d984 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -480,6 +480,9 @@ static int try_prep_async_create(struct inode *dir, struct dentry *dentry, if (d_in_lookup(dentry)) { if (!__ceph_dir_is_complete(ci)) goto no_async; + spin_lock(&dentry->d_lock); + di->lease_shared_gen = atomic_read(&ci->i_shared_gen); + spin_unlock(&dentry->d_lock); } else if (atomic_read(&ci->i_shared_gen) != READ_ONCE(di->lease_shared_gen)) { goto no_async;