Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rpc_pipe: clean failure exits in fill_super

->kill_sb() will be called immediately after a failure return
anyway, so we don't need to bother with notifier chain and
rpc_gssd_dummy_depopulate(). What's more, rpc_gssd_dummy_populate()
failure exits do not need to bother with __rpc_depopulate() -
anything added to the tree will be taken out by ->kill_sb().

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

+16 -51
+16 -51
net/sunrpc/rpc_pipe.c
··· 1292 1292 * Create a dummy set of directories and a pipe that gssd can hold open to 1293 1293 * indicate that it is up and running. 1294 1294 */ 1295 - static struct dentry * 1295 + static int 1296 1296 rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) 1297 1297 { 1298 1298 int ret = 0; ··· 1303 1303 /* We should never get this far if "gssd" doesn't exist */ 1304 1304 gssd_dentry = try_lookup_noperm(&QSTR(files[RPCAUTH_gssd].name), root); 1305 1305 if (!gssd_dentry) 1306 - return ERR_PTR(-ENOENT); 1306 + return -ENOENT; 1307 1307 1308 1308 ret = rpc_populate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1, NULL); 1309 1309 if (ret) { 1310 - pipe_dentry = ERR_PTR(ret); 1311 - goto out; 1310 + dput(gssd_dentry); 1311 + return ret; 1312 1312 } 1313 1313 1314 1314 clnt_dentry = try_lookup_noperm(&QSTR(gssd_dummy_clnt_dir[0].name), 1315 1315 gssd_dentry); 1316 - if (!clnt_dentry) { 1317 - __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); 1318 - pipe_dentry = ERR_PTR(-ENOENT); 1319 - goto out; 1320 - } 1316 + dput(gssd_dentry); 1317 + if (!clnt_dentry) 1318 + return -ENOENT; 1321 1319 1322 1320 ret = rpc_populate(clnt_dentry, gssd_dummy_info_file, 0, 1, NULL); 1323 1321 if (ret) { 1324 - __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); 1325 - pipe_dentry = ERR_PTR(ret); 1326 - goto out; 1322 + dput(clnt_dentry); 1323 + return ret; 1327 1324 } 1328 - 1329 1325 pipe_dentry = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data); 1330 - if (IS_ERR(pipe_dentry)) { 1331 - __rpc_depopulate(clnt_dentry, gssd_dummy_info_file, 0, 1); 1332 - __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); 1333 - } 1334 - out: 1335 1326 dput(clnt_dentry); 1336 - dput(gssd_dentry); 1337 - return pipe_dentry; 1338 - } 1339 - 1340 - static void 1341 - rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry) 1342 - { 1343 - struct dentry *clnt_dir = pipe_dentry->d_parent; 1344 - struct dentry *gssd_dir = clnt_dir->d_parent; 1345 - 1346 - dget(pipe_dentry); 1347 - __rpc_rmpipe(d_inode(clnt_dir), pipe_dentry); 1348 - __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1); 1349 - __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1); 1350 - dput(pipe_dentry); 1327 + if (IS_ERR(pipe_dentry)) 1328 + ret = PTR_ERR(pipe_dentry); 1329 + return ret; 1351 1330 } 1352 1331 1353 1332 static int 1354 1333 rpc_fill_super(struct super_block *sb, struct fs_context *fc) 1355 1334 { 1356 1335 struct inode *inode; 1357 - struct dentry *root, *gssd_dentry; 1336 + struct dentry *root; 1358 1337 struct net *net = sb->s_fs_info; 1359 1338 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 1360 1339 int err; ··· 1352 1373 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) 1353 1374 return -ENOMEM; 1354 1375 1355 - gssd_dentry = rpc_gssd_dummy_populate(root, sn->gssd_dummy); 1356 - if (IS_ERR(gssd_dentry)) { 1357 - __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); 1358 - return PTR_ERR(gssd_dentry); 1359 - } 1376 + err = rpc_gssd_dummy_populate(root, sn->gssd_dummy); 1377 + if (err) 1378 + return err; 1360 1379 1361 1380 dprintk("RPC: sending pipefs MOUNT notification for net %x%s\n", 1362 1381 net->ns.inum, NET_NAME(net)); ··· 1363 1386 err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, 1364 1387 RPC_PIPEFS_MOUNT, 1365 1388 sb); 1366 - if (err) 1367 - goto err_depopulate; 1368 - mutex_unlock(&sn->pipefs_sb_lock); 1369 - return 0; 1370 - 1371 - err_depopulate: 1372 - rpc_gssd_dummy_depopulate(gssd_dentry); 1373 - blocking_notifier_call_chain(&rpc_pipefs_notifier_list, 1374 - RPC_PIPEFS_UMOUNT, 1375 - sb); 1376 - sn->pipefs_sb = NULL; 1377 - __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); 1378 1389 mutex_unlock(&sn->pipefs_sb_lock); 1379 1390 return err; 1380 1391 }