]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ceph: clear d_fsinfo pointer under d_lock
authorJeff Layton <jlayton@redhat.com>
Fri, 1 Jul 2016 13:39:20 +0000 (09:39 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 28 Jul 2016 01:00:39 +0000 (03:00 +0200)
To check for a valid dentry lease, we need to get at the
ceph_dentry_info. Under rcuwalk though, we may end up with a dentry that
is on its way to destruction. Since we need to take the d_lock in
dentry_lease_is_valid already, we can just ensure that we clear the
d_fsinfo pointer out under the same lock before destroying it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/dir.c

index 8ff7bcc7fc88890a2c4fbfc7a25cca2b11c9b4f3..904dc671580f06928a9eea047a4606a70379f4e5 100644 (file)
@@ -1286,10 +1286,14 @@ static void ceph_d_release(struct dentry *dentry)
 
        dout("d_release %p\n", dentry);
        ceph_dentry_lru_del(dentry);
+
+       spin_lock(&dentry->d_lock);
+       dentry->d_fsdata = NULL;
+       spin_unlock(&dentry->d_lock);
+
        if (di->lease_session)
                ceph_put_mds_session(di->lease_session);
        kmem_cache_free(ceph_dentry_cachep, di);
-       dentry->d_fsdata = NULL;
 }
 
 static int ceph_snapdir_d_revalidate(struct dentry *dentry,