]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
NFS: get module in idmap PipeFS notifier callback
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Sat, 28 Apr 2012 15:32:21 +0000 (19:32 +0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 28 Apr 2012 17:22:19 +0000 (13:22 -0400)
This is bug fix.
Notifier callback is called from SUNRPC module. So before dereferencing NFS
module we have to make sure, that it's alive.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/idmap.c

index b7f348bb618b8d8864f7a5e2569aff8f4ef4e3a7..ba3019f5934c21a610a96569b1d239b90eca0459 100644 (file)
@@ -554,12 +554,16 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
        struct nfs_client *clp;
        int error = 0;
 
+       if (!try_module_get(THIS_MODULE))
+               return 0;
+
        while ((clp = nfs_get_client_for_event(sb->s_fs_info, event))) {
                error = __rpc_pipefs_event(clp, event, sb);
                nfs_put_client(clp);
                if (error)
                        break;
        }
+       module_put(THIS_MODULE);
        return error;
 }