@@ -309,9 +309,7 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc)
309
309
struct autofs_fs_context * ctx = fc -> fs_private ;
310
310
struct autofs_sb_info * sbi = s -> s_fs_info ;
311
311
struct inode * root_inode ;
312
- struct dentry * root ;
313
312
struct autofs_info * ino ;
314
- int ret = - ENOMEM ;
315
313
316
314
pr_debug ("starting up, sbi = %p\n" , sbi );
317
315
@@ -328,56 +326,44 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc)
328
326
*/
329
327
ino = autofs_new_ino (sbi );
330
328
if (!ino )
331
- goto fail ;
329
+ return - ENOMEM ;
332
330
333
331
root_inode = autofs_get_inode (s , S_IFDIR | 0755 );
332
+ if (!root_inode )
333
+ return - ENOMEM ;
334
+
334
335
root_inode -> i_uid = ctx -> uid ;
335
336
root_inode -> i_gid = ctx -> gid ;
337
+ root_inode -> i_fop = & autofs_root_operations ;
338
+ root_inode -> i_op = & autofs_dir_inode_operations ;
336
339
337
- root = d_make_root (root_inode );
338
- if (!root )
339
- goto fail_ino ;
340
-
341
- root -> d_fsdata = ino ;
340
+ s -> s_root = d_make_root (root_inode );
341
+ if (unlikely (!s -> s_root )) {
342
+ autofs_free_ino (ino );
343
+ return - ENOMEM ;
344
+ }
345
+ s -> s_root -> d_fsdata = ino ;
342
346
343
347
if (ctx -> pgrp_set ) {
344
348
sbi -> oz_pgrp = find_get_pid (ctx -> pgrp );
345
- if (!sbi -> oz_pgrp ) {
346
- ret = invalf (fc , "Could not find process group %d" ,
347
- ctx -> pgrp );
348
- goto fail_dput ;
349
- }
350
- } else {
349
+ if (!sbi -> oz_pgrp )
350
+ return invalf (fc , "Could not find process group %d" ,
351
+ ctx -> pgrp );
352
+ } else
351
353
sbi -> oz_pgrp = get_task_pid (current , PIDTYPE_PGID );
352
- }
353
354
354
355
if (autofs_type_trigger (sbi -> type ))
355
- __managed_dentry_set_managed (root );
356
-
357
- root_inode -> i_fop = & autofs_root_operations ;
358
- root_inode -> i_op = & autofs_dir_inode_operations ;
356
+ /* s->s_root won't be contended so there's little to
357
+ * be gained by not taking the d_lock when setting
358
+ * d_flags, even when a lot mounts are being done.
359
+ */
360
+ managed_dentry_set_managed (s -> s_root );
359
361
360
362
pr_debug ("pipe fd = %d, pgrp = %u\n" ,
361
363
sbi -> pipefd , pid_nr (sbi -> oz_pgrp ));
362
364
363
365
sbi -> flags &= ~AUTOFS_SBI_CATATONIC ;
364
-
365
- /*
366
- * Success! Install the root dentry now to indicate completion.
367
- */
368
- s -> s_root = root ;
369
366
return 0 ;
370
-
371
- /*
372
- * Failure ... clean up.
373
- */
374
- fail_dput :
375
- dput (root );
376
- goto fail ;
377
- fail_ino :
378
- autofs_free_ino (ino );
379
- fail :
380
- return ret ;
381
367
}
382
368
383
369
/*
0 commit comments