diff options
author | Giuseppe Cantavenera <giuseppe.cantavenera.ext@nokia.com> | 2015-04-20 12:00:08 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2015-04-21 16:16:03 -0400 |
commit | bb7ffbf29e76b89a86ca4c3ee0d4690641f2f772 (patch) | |
tree | cafb6c6eae841ad534e3a92964624f0b663224a2 /fs/nfsd | |
parent | 135dd002c23054aaa056ea3162c1e0356905c195 (diff) |
nfsd: fix nsfd startup race triggering BUG_ON
nfsd triggered a BUG_ON in net_generic(...) when rpc_pipefs_event(...)
in fs/nfsd/nfs4recover.c was called before assigning ntfsd_net_id.
The following was observed on a MIPS 32-core processor:
kernel: Call Trace:
kernel: [<ffffffffc00bc5e4>] rpc_pipefs_event+0x7c/0x158 [nfsd]
kernel: [<ffffffff8017a2a0>] notifier_call_chain+0x70/0xb8
kernel: [<ffffffff8017a4e4>] __blocking_notifier_call_chain+0x4c/0x70
kernel: [<ffffffff8053aff8>] rpc_fill_super+0xf8/0x1a0
kernel: [<ffffffff8022204c>] mount_ns+0xb4/0xf0
kernel: [<ffffffff80222b48>] mount_fs+0x50/0x1f8
kernel: [<ffffffff8023dc00>] vfs_kern_mount+0x58/0xf0
kernel: [<ffffffff802404ac>] do_mount+0x27c/0xa28
kernel: [<ffffffff80240cf0>] SyS_mount+0x98/0xe8
kernel: [<ffffffff80135d24>] handle_sys64+0x44/0x68
kernel:
kernel:
Code: 0040f809 00000000 2e020001 <00020336> 3c12c00d
3c02801a de100000 6442eb98 0040f809
kernel: ---[ end trace 7471374335809536 ]---
Fixed this behaviour by calling register_pernet_subsys(&nfsd_net_ops) before
registering rpc_pipefs_event(...) with the notifier chain.
Signed-off-by: Giuseppe Cantavenera <giuseppe.cantavenera.ext@nokia.com>
Signed-off-by: Lorenzo Restelli <lorenzo.restelli.ext@nokia.com>
Reviewed-by: Kinlong Mee <kinglongmee@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfsctl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index aa47d75ddb26..9690cb4dd588 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -1250,15 +1250,15 @@ static int __init init_nfsd(void) | |||
1250 | int retval; | 1250 | int retval; |
1251 | printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); | 1251 | printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); |
1252 | 1252 | ||
1253 | retval = register_cld_notifier(); | ||
1254 | if (retval) | ||
1255 | return retval; | ||
1256 | retval = register_pernet_subsys(&nfsd_net_ops); | 1253 | retval = register_pernet_subsys(&nfsd_net_ops); |
1257 | if (retval < 0) | 1254 | if (retval < 0) |
1258 | goto out_unregister_notifier; | 1255 | return retval; |
1259 | retval = nfsd4_init_slabs(); | 1256 | retval = register_cld_notifier(); |
1260 | if (retval) | 1257 | if (retval) |
1261 | goto out_unregister_pernet; | 1258 | goto out_unregister_pernet; |
1259 | retval = nfsd4_init_slabs(); | ||
1260 | if (retval) | ||
1261 | goto out_unregister_notifier; | ||
1262 | retval = nfsd4_init_pnfs(); | 1262 | retval = nfsd4_init_pnfs(); |
1263 | if (retval) | 1263 | if (retval) |
1264 | goto out_free_slabs; | 1264 | goto out_free_slabs; |
@@ -1290,10 +1290,10 @@ out_exit_pnfs: | |||
1290 | nfsd4_exit_pnfs(); | 1290 | nfsd4_exit_pnfs(); |
1291 | out_free_slabs: | 1291 | out_free_slabs: |
1292 | nfsd4_free_slabs(); | 1292 | nfsd4_free_slabs(); |
1293 | out_unregister_pernet: | ||
1294 | unregister_pernet_subsys(&nfsd_net_ops); | ||
1295 | out_unregister_notifier: | 1293 | out_unregister_notifier: |
1296 | unregister_cld_notifier(); | 1294 | unregister_cld_notifier(); |
1295 | out_unregister_pernet: | ||
1296 | unregister_pernet_subsys(&nfsd_net_ops); | ||
1297 | return retval; | 1297 | return retval; |
1298 | } | 1298 | } |
1299 | 1299 | ||
@@ -1308,8 +1308,8 @@ static void __exit exit_nfsd(void) | |||
1308 | nfsd4_exit_pnfs(); | 1308 | nfsd4_exit_pnfs(); |
1309 | nfsd_fault_inject_cleanup(); | 1309 | nfsd_fault_inject_cleanup(); |
1310 | unregister_filesystem(&nfsd_fs_type); | 1310 | unregister_filesystem(&nfsd_fs_type); |
1311 | unregister_pernet_subsys(&nfsd_net_ops); | ||
1312 | unregister_cld_notifier(); | 1311 | unregister_cld_notifier(); |
1312 | unregister_pernet_subsys(&nfsd_net_ops); | ||
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); | 1315 | MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); |