cifs: rcu-delay unload_nls() and freeing sbi
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 3 Oct 2013 16:53:37 +0000 (12:53 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 25 Oct 2013 03:43:27 +0000 (23:43 -0400)
makes ->d_hash(), ->d_compare() and ->permission() safety in RCU mode
independent from vfsmount_lock.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/cifs/cifs_fs_sb.h
fs/cifs/connect.c

index 37e4a72a7d1c46389c35736d66f1636891874ba4..9409fa10bd5cd9063159c1d3d49ca1cb8f422817 100644 (file)
@@ -65,5 +65,6 @@ struct cifs_sb_info {
        char   *mountdata; /* options received at mount time or via DFS refs */
        struct backing_dev_info bdi;
        struct delayed_work prune_tlinks;
+       struct rcu_head rcu;
 };
 #endif                         /* _CIFS_FS_SB_H */
index a279ffc0bc29577ed447319467b2e92248f09149..886db8b41e3595d134c862444a5a2d087f0362b2 100644 (file)
@@ -3755,6 +3755,13 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
        return rc;
 }
 
+static void delayed_free(struct rcu_head *p)
+{
+       struct cifs_sb_info *sbi = container_of(p, struct cifs_sb_info, rcu);
+       unload_nls(sbi->local_nls);
+       kfree(sbi);
+}
+
 void
 cifs_umount(struct cifs_sb_info *cifs_sb)
 {
@@ -3779,8 +3786,7 @@ cifs_umount(struct cifs_sb_info *cifs_sb)
 
        bdi_destroy(&cifs_sb->bdi);
        kfree(cifs_sb->mountdata);
-       unload_nls(cifs_sb->local_nls);
-       kfree(cifs_sb);
+       call_rcu(&cifs_sb->rcu, delayed_free);
 }
 
 int