Message ID | 20231116000746.7359-1-raven@themaw.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2894423vqg; Wed, 15 Nov 2023 16:15:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjUT0WNnXmFQCLUGeUzZ99F5VumK2O1+IclZ+8FYQB3ey0LCcPXiNqdicUblGtmv0dPW2/ X-Received: by 2002:a17:90b:1e4a:b0:283:2d65:f216 with SMTP id pi10-20020a17090b1e4a00b002832d65f216mr12806708pjb.39.1700093702393; Wed, 15 Nov 2023 16:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700093702; cv=none; d=google.com; s=arc-20160816; b=jDyxbVCJgBWTUdsYp+sqTR0HyBWSw6aKsMPhZvUSl2NsUIWlGNTyMhV4Bpj1CEi4GA LDQeYblkndH5iAeuqu6CUq1KsRMnJZpOUf74szotIEol9DgxFwr6EffpRmFscGeVkUJm iogSIyMSMNp8GQheTsCyXp/CzK3bWhKpHFQR0ZFOfthQ4sBrlbdAIattYGQ90BIMGijX AuZYgKJ7BfUCM81rs4PEk+qmw9OMTziqBMVtAsmYVaPWk6DrKCOFedma1paPtKS5P9aZ h4ynRziVo3tICwsF5uchMiCB7kGH3U3tldkkjrS/caYt2akYXV/3+MsAYTukLmU7DLxA NWtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qHx930yK5EwudtE/lUDrovnQN403kqMt8qXwV6ytSjU=; fh=NgjoLSA/cFml66RbTiPwTYFkNlfHfz/KSqC8Agsw6ss=; b=AONWwACJJFLZcDvHR9BpinNJxUv6k0HPyRLjUUteKmX0l+CWiTSr6/XA9rNfqSOE+i PyBTno/ka3K/ZxE8Fi+WfZaGWhZekHzwy9NxT6h15KMXZk2Zix0TYv2lVrHR8ToOMBpw 3Hd58TlacO4PZP1J0c+zpmKQ93FAhiwmgY+9KI7XXyjbVsYtyB0E2lHYFEHiZt2w0TtN YFpejeohj7aGXtqtt3IT3DTuYvnWEpek36XTkdAydnOO08ANGJv6Bcx0Z1n3zX9ChV6v 4QHJqrVMPBizJLiUVajqMtzLT18L+0vUEcSwH5QHw/X7MXbhz1OqOeNezidJM6MYE6nD pvlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id il16-20020a17090b165000b0026c198d8182si777346pjb.105.2023.11.15.16.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 16:15:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 22C5180613B0; Wed, 15 Nov 2023 16:15:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbjKPAIE (ORCPT <rfc822;lhua1029@gmail.com> + 28 others); Wed, 15 Nov 2023 19:08:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbjKPAID (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Nov 2023 19:08:03 -0500 Received: from smtp01.aussiebb.com.au (smtp01.aussiebb.com.au [IPv6:2403:5800:3:25::1001]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B10AA19E; Wed, 15 Nov 2023 16:07:56 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp01.aussiebb.com.au (Postfix) with ESMTP id 8D4B6100382; Thu, 16 Nov 2023 11:07:51 +1100 (AEDT) X-Virus-Scanned: Debian amavisd-new at smtp01.aussiebb.com.au Received: from smtp01.aussiebb.com.au ([127.0.0.1]) by localhost (smtp01.aussiebb.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iXf2Fp4tVd8S; Thu, 16 Nov 2023 11:07:51 +1100 (AEDT) Received: by smtp01.aussiebb.com.au (Postfix, from userid 116) id 82227100369; Thu, 16 Nov 2023 11:07:51 +1100 (AEDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 Received: from donald.themaw.com (2403-580f-7fe0--101a.ip6.aussiebb.net [IPv6:2403:580f:7fe0::101a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ian146@aussiebb.com.au) by smtp01.aussiebb.com.au (Postfix) with ESMTPSA id C1732100290; Thu, 16 Nov 2023 11:07:49 +1100 (AEDT) From: Ian Kent <raven@themaw.net> To: Al Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org> Cc: Bill O'Donnell <billodo@redhat.com>, Kernel Mailing List <linux-kernel@vger.kernel.org>, autofs mailing list <autofs@vger.kernel.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, Ian Kent <raven@themaw.net>, syzbot+662f87a8ef490f45fa64@syzkaller.appspotmail.com Subject: [PATCH] autofs: add: new_inode check in autofs_fill_super() Date: Thu, 16 Nov 2023 08:07:46 +0800 Message-ID: <20231116000746.7359-1-raven@themaw.net> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 16:15:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782677454136449311 X-GMAIL-MSGID: 1782677454136449311 |
Series |
autofs: add: new_inode check in autofs_fill_super()
|
|
Commit Message
Ian Kent
Nov. 16, 2023, 12:07 a.m. UTC
Add missing NULL check of root_inode in autofs_fill_super().
While we are at it simplify the logic by taking advantage of the VFS
cleanup procedures and get rid of the goto error handling, as suggested
by Al Viro.
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Bill O'Donnell <billodo@redhat.com>
Reported-by: syzbot+662f87a8ef490f45fa64@syzkaller.appspotmail.com
---
fs/autofs/inode.c | 50 ++++++++++++++++++-----------------------------
1 file changed, 19 insertions(+), 31 deletions(-)
Comments
Hi Ian, kernel test robot noticed the following build errors: [auto build test ERROR on brauner-vfs/vfs.all] [also build test ERROR on linus/master v6.7-rc1 next-20231116] [cannot apply to vfs-idmapping/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Ian-Kent/autofs-add-new_inode-check-in-autofs_fill_super/20231116-081017 base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all patch link: https://lore.kernel.org/r/20231116000746.7359-1-raven%40themaw.net patch subject: [PATCH] autofs: add: new_inode check in autofs_fill_super() config: i386-buildonly-randconfig-001-20231116 (https://download.01.org/0day-ci/archive/20231116/202311161857.bZMQmWsW-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311161857.bZMQmWsW-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311161857.bZMQmWsW-lkp@intel.com/ All error/warnings (new ones prefixed by >>): fs/autofs/inode.c: In function 'autofs_fill_super': >> fs/autofs/inode.c:330:22: error: expected identifier or '*' before '-' token 330 | goto -ENOMEM; | ^ >> fs/autofs/inode.c:349:25: error: 'ret' undeclared (first use in this function); did you mean 'net'? 349 | ret = invalf(fc, "Could not find process group %d", | ^~~ | net fs/autofs/inode.c:349:25: note: each undeclared identifier is reported only once for each function it appears in >> fs/autofs/inode.c:312:24: warning: unused variable 'root' [-Wunused-variable] 312 | struct dentry *root; | ^~~~ vim +330 fs/autofs/inode.c 306 307 static int autofs_fill_super(struct super_block *s, struct fs_context *fc) 308 { 309 struct autofs_fs_context *ctx = fc->fs_private; 310 struct autofs_sb_info *sbi = s->s_fs_info; 311 struct inode *root_inode; > 312 struct dentry *root; 313 struct autofs_info *ino; 314 315 pr_debug("starting up, sbi = %p\n", sbi); 316 317 sbi->sb = s; 318 s->s_blocksize = 1024; 319 s->s_blocksize_bits = 10; 320 s->s_magic = AUTOFS_SUPER_MAGIC; 321 s->s_op = &autofs_sops; 322 s->s_d_op = &autofs_dentry_operations; 323 s->s_time_gran = 1; 324 325 /* 326 * Get the root inode and dentry, but defer checking for errors. 327 */ 328 ino = autofs_new_ino(sbi); 329 if (!ino) > 330 goto -ENOMEM; 331 332 root_inode = autofs_get_inode(s, S_IFDIR | 0755); 333 if (root_inode) { 334 root_inode->i_uid = ctx->uid; 335 root_inode->i_gid = ctx->gid; 336 root_inode->i_fop = &autofs_root_operations; 337 root_inode->i_op = &autofs_dir_inode_operations; 338 } 339 s->s_root = d_make_root(root_inode); 340 if (unlikely(!s->s_root)) { 341 autofs_free_ino(ino); 342 return -ENOMEM; 343 } 344 s->s_root->d_fsdata = ino; 345 346 if (ctx->pgrp_set) { 347 sbi->oz_pgrp = find_get_pid(ctx->pgrp); 348 if (!sbi->oz_pgrp) { > 349 ret = invalf(fc, "Could not find process group %d", 350 ctx->pgrp); 351 return ret; 352 } 353 } else { 354 sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); 355 } 356 357 if (autofs_type_trigger(sbi->type)) 358 /* s->s_root won't be contended so there's little to 359 * be gained by not taking the d_lock when setting 360 * d_flags, even when a lot mounts are being done. 361 */ 362 managed_dentry_set_managed(s->s_root); 363 364 pr_debug("pipe fd = %d, pgrp = %u\n", 365 sbi->pipefd, pid_nr(sbi->oz_pgrp)); 366 367 sbi->flags &= ~AUTOFS_SBI_CATATONIC; 368 return 0; 369 } 370
Hi Ian, kernel test robot noticed the following build warnings: [auto build test WARNING on brauner-vfs/vfs.all] [also build test WARNING on linus/master v6.7-rc1 next-20231116] [cannot apply to vfs-idmapping/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Ian-Kent/autofs-add-new_inode-check-in-autofs_fill_super/20231116-081017 base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all patch link: https://lore.kernel.org/r/20231116000746.7359-1-raven%40themaw.net patch subject: [PATCH] autofs: add: new_inode check in autofs_fill_super() config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231116/202311161909.KHau6jEj-lkp@intel.com/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311161909.KHau6jEj-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311161909.KHau6jEj-lkp@intel.com/ All warnings (new ones prefixed by >>): fs/autofs/inode.c:330:8: error: expected identifier goto -ENOMEM; ^ >> fs/autofs/inode.c:330:8: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] fs/autofs/inode.c:329:2: note: previous statement is here if (!ino) ^ fs/autofs/inode.c:349:4: error: use of undeclared identifier 'ret' ret = invalf(fc, "Could not find process group %d", ^ fs/autofs/inode.c:351:11: error: use of undeclared identifier 'ret' return ret; ^ >> fs/autofs/inode.c:330:8: warning: expression result unused [-Wunused-value] goto -ENOMEM; ^~~~~~~ 2 warnings and 3 errors generated. vim +/if +330 fs/autofs/inode.c 306 307 static int autofs_fill_super(struct super_block *s, struct fs_context *fc) 308 { 309 struct autofs_fs_context *ctx = fc->fs_private; 310 struct autofs_sb_info *sbi = s->s_fs_info; 311 struct inode *root_inode; 312 struct dentry *root; 313 struct autofs_info *ino; 314 315 pr_debug("starting up, sbi = %p\n", sbi); 316 317 sbi->sb = s; 318 s->s_blocksize = 1024; 319 s->s_blocksize_bits = 10; 320 s->s_magic = AUTOFS_SUPER_MAGIC; 321 s->s_op = &autofs_sops; 322 s->s_d_op = &autofs_dentry_operations; 323 s->s_time_gran = 1; 324 325 /* 326 * Get the root inode and dentry, but defer checking for errors. 327 */ 328 ino = autofs_new_ino(sbi); 329 if (!ino) > 330 goto -ENOMEM; 331 332 root_inode = autofs_get_inode(s, S_IFDIR | 0755); 333 if (root_inode) { 334 root_inode->i_uid = ctx->uid; 335 root_inode->i_gid = ctx->gid; 336 root_inode->i_fop = &autofs_root_operations; 337 root_inode->i_op = &autofs_dir_inode_operations; 338 } 339 s->s_root = d_make_root(root_inode); 340 if (unlikely(!s->s_root)) { 341 autofs_free_ino(ino); 342 return -ENOMEM; 343 } 344 s->s_root->d_fsdata = ino; 345 346 if (ctx->pgrp_set) { 347 sbi->oz_pgrp = find_get_pid(ctx->pgrp); 348 if (!sbi->oz_pgrp) { 349 ret = invalf(fc, "Could not find process group %d", 350 ctx->pgrp); 351 return ret; 352 } 353 } else { 354 sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); 355 } 356 357 if (autofs_type_trigger(sbi->type)) 358 /* s->s_root won't be contended so there's little to 359 * be gained by not taking the d_lock when setting 360 * d_flags, even when a lot mounts are being done. 361 */ 362 managed_dentry_set_managed(s->s_root); 363 364 pr_debug("pipe fd = %d, pgrp = %u\n", 365 sbi->pipefd, pid_nr(sbi->oz_pgrp)); 366 367 sbi->flags &= ~AUTOFS_SBI_CATATONIC; 368 return 0; 369 } 370
On 16/11/23 19:23, kernel test robot wrote: > Hi Ian, > > kernel test robot noticed the following build warnings: Crikey, how did this compile ... I think I need to just send a replacement patch. Ian > [auto build test WARNING on brauner-vfs/vfs.all] > [also build test WARNING on linus/master v6.7-rc1 next-20231116] > [cannot apply to vfs-idmapping/for-next] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url:https://github.com/intel-lab-lkp/linux/commits/Ian-Kent/autofs-add-new_inode-check-in-autofs_fill_super/20231116-081017 > base:https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all > patch link:https://lore.kernel.org/r/20231116000746.7359-1-raven%40themaw.net > patch subject: [PATCH] autofs: add: new_inode check in autofs_fill_super() > config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231116/202311161909.KHau6jEj-lkp@intel.com/config) > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311161909.KHau6jEj-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot<lkp@intel.com> > | Closes:https://lore.kernel.org/oe-kbuild-all/202311161909.KHau6jEj-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > fs/autofs/inode.c:330:8: error: expected identifier > goto -ENOMEM; > ^ >>> fs/autofs/inode.c:330:8: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] > fs/autofs/inode.c:329:2: note: previous statement is here > if (!ino) > ^ > fs/autofs/inode.c:349:4: error: use of undeclared identifier 'ret' > ret = invalf(fc, "Could not find process group %d", > ^ > fs/autofs/inode.c:351:11: error: use of undeclared identifier 'ret' > return ret; > ^ >>> fs/autofs/inode.c:330:8: warning: expression result unused [-Wunused-value] > goto -ENOMEM; > ^~~~~~~ > 2 warnings and 3 errors generated. > > > vim +/if +330 fs/autofs/inode.c > > 306 > 307 static int autofs_fill_super(struct super_block *s, struct fs_context *fc) > 308 { > 309 struct autofs_fs_context *ctx = fc->fs_private; > 310 struct autofs_sb_info *sbi = s->s_fs_info; > 311 struct inode *root_inode; > 312 struct dentry *root; > 313 struct autofs_info *ino; > 314 > 315 pr_debug("starting up, sbi = %p\n", sbi); > 316 > 317 sbi->sb = s; > 318 s->s_blocksize = 1024; > 319 s->s_blocksize_bits = 10; > 320 s->s_magic = AUTOFS_SUPER_MAGIC; > 321 s->s_op = &autofs_sops; > 322 s->s_d_op = &autofs_dentry_operations; > 323 s->s_time_gran = 1; > 324 > 325 /* > 326 * Get the root inode and dentry, but defer checking for errors. > 327 */ > 328 ino = autofs_new_ino(sbi); > 329 if (!ino) > > 330 goto -ENOMEM; > 331 > 332 root_inode = autofs_get_inode(s, S_IFDIR | 0755); > 333 if (root_inode) { > 334 root_inode->i_uid = ctx->uid; > 335 root_inode->i_gid = ctx->gid; > 336 root_inode->i_fop = &autofs_root_operations; > 337 root_inode->i_op = &autofs_dir_inode_operations; > 338 } > 339 s->s_root = d_make_root(root_inode); > 340 if (unlikely(!s->s_root)) { > 341 autofs_free_ino(ino); > 342 return -ENOMEM; > 343 } > 344 s->s_root->d_fsdata = ino; > 345 > 346 if (ctx->pgrp_set) { > 347 sbi->oz_pgrp = find_get_pid(ctx->pgrp); > 348 if (!sbi->oz_pgrp) { > 349 ret = invalf(fc, "Could not find process group %d", > 350 ctx->pgrp); > 351 return ret; > 352 } > 353 } else { > 354 sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); > 355 } > 356 > 357 if (autofs_type_trigger(sbi->type)) > 358 /* s->s_root won't be contended so there's little to > 359 * be gained by not taking the d_lock when setting > 360 * d_flags, even when a lot mounts are being done. > 361 */ > 362 managed_dentry_set_managed(s->s_root); > 363 > 364 pr_debug("pipe fd = %d, pgrp = %u\n", > 365 sbi->pipefd, pid_nr(sbi->oz_pgrp)); > 366 > 367 sbi->flags &= ~AUTOFS_SBI_CATATONIC; > 368 return 0; > 369 } > 370 >
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index a5083d447a62..d5dd4223b461 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -311,7 +311,6 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc) struct inode *root_inode; struct dentry *root; struct autofs_info *ino; - int ret = -ENOMEM; pr_debug("starting up, sbi = %p\n", sbi); @@ -328,56 +327,45 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc) */ ino = autofs_new_ino(sbi); if (!ino) - goto fail; + goto -ENOMEM; root_inode = autofs_get_inode(s, S_IFDIR | 0755); - root_inode->i_uid = ctx->uid; - root_inode->i_gid = ctx->gid; - - root = d_make_root(root_inode); - if (!root) - goto fail_ino; - - root->d_fsdata = ino; + if (root_inode) { + root_inode->i_uid = ctx->uid; + root_inode->i_gid = ctx->gid; + root_inode->i_fop = &autofs_root_operations; + root_inode->i_op = &autofs_dir_inode_operations; + } + s->s_root = d_make_root(root_inode); + if (unlikely(!s->s_root)) { + autofs_free_ino(ino); + return -ENOMEM; + } + s->s_root->d_fsdata = ino; if (ctx->pgrp_set) { sbi->oz_pgrp = find_get_pid(ctx->pgrp); if (!sbi->oz_pgrp) { ret = invalf(fc, "Could not find process group %d", ctx->pgrp); - goto fail_dput; + return ret; } } else { sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); } if (autofs_type_trigger(sbi->type)) - __managed_dentry_set_managed(root); - - root_inode->i_fop = &autofs_root_operations; - root_inode->i_op = &autofs_dir_inode_operations; + /* s->s_root won't be contended so there's little to + * be gained by not taking the d_lock when setting + * d_flags, even when a lot mounts are being done. + */ + managed_dentry_set_managed(s->s_root); pr_debug("pipe fd = %d, pgrp = %u\n", sbi->pipefd, pid_nr(sbi->oz_pgrp)); sbi->flags &= ~AUTOFS_SBI_CATATONIC; - - /* - * Success! Install the root dentry now to indicate completion. - */ - s->s_root = root; return 0; - - /* - * Failure ... clean up. - */ -fail_dput: - dput(root); - goto fail; -fail_ino: - autofs_free_ino(ino); -fail: - return ret; } /*