Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp57874imm; Thu, 7 Jun 2018 13:46:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKKbgTd6LG4GlU/vpbC4p4Hcn5L5RvIMEVza3SilssDRFtyf9e6NkJLsbcMr66Xk4qsixXa X-Received: by 2002:a65:6343:: with SMTP id p3-v6mr2818410pgv.63.1528404374966; Thu, 07 Jun 2018 13:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528404374; cv=none; d=google.com; s=arc-20160816; b=PyyXDz8IMR0nfKMKPgJJ3uAI6jTqen/NRO7qxtTbvad+tE8xphLGL+XbjJrq9iqszC WRKDSMhHMXQAHnVtwC6Vxw2bkvziDYgDSwJQNST6/T/hzjxXaRyWu2zrRtteVQW0K8ed P5jJUgfEMoyvu9hPUZ8gYFBdy4fJrKKE6JV5NPe7MQpiC7eq2ZtuMTx3cxqIl3AKCc9a Cz5hoDRkp8CVydNVa8VLuoy0Av5wqHg+EBDb+HdhtPV7sMc34/uSc0HQBX3L1JlQUb3L p0cemMJwA4K37uWakHrQdkuGhQ+YOGzr+/wxHXHpMQbAISiMy9cD6pZuEEumWNsuT8V6 NnaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=wGVh6wgyqUFovD4BEWt6EGYxbF10fC6NW7ovDm6fCgU=; b=bV0Ql8UA3l7gSPsUQLJfzzjfJ8pbl9B6LW4OkM0mCPR/6veDPhCjzioaKKQ4pNSdE0 hUaI5eQlcrLOHEexkTK+6bs3o3MDNhCA+lXOL5wNKRc45inDB9P4pK9ePbk/V68Kw4BD 00T6dVu0v/zZOIy/MLPSPtP9Bsjatj7E4N2OcYmOb62TAr10ob3Vq3DhOx7x6BJYWAz9 08WaWVaTwEW1A7NnWiBMp7jc8R+mTgzBPsEiK4kq372Dw6JuJePZDq6Vt+rf+s3fmQPg bVlb8EG2dKcAKOqD4IB1m8Mq9nEOGpnk/u4u9nrmifYc90Ha+fYLyhesgpQBmx7BvF5V 3ulA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9-v6si5534674pfg.323.2018.06.07.13.46.00; Thu, 07 Jun 2018 13:46:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932471AbeFGUpd (ORCPT + 99 others); Thu, 7 Jun 2018 16:45:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750914AbeFGUpc (ORCPT ); Thu, 7 Jun 2018 16:45:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95A6610D441; Thu, 7 Jun 2018 20:45:31 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-245.rdu2.redhat.com [10.10.121.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E6772166BB2; Thu, 7 Jun 2018 20:45:30 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1917614e-97dc-c911-c2d1-cc5d002d2071@suse.de> References: <1917614e-97dc-c911-c2d1-cc5d002d2071@suse.de> <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720689245.9073.17300569813645143102.stgit@warthog.procyon.org.uk> To: Goldwyn Rodrigues Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 26/32] afs: Use fs_context to pass parameters over automount [ver #8] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14466.1528404329.1@warthog.procyon.org.uk> Date: Thu, 07 Jun 2018 21:45:29 +0100 Message-ID: <14467.1528404329@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 07 Jun 2018 20:45:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 07 Jun 2018 20:45:31 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Goldwyn Rodrigues wrote: Goldwyn Rodrigues wrote: > > +static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) > > +{ > > + struct fs_context *fc; > > + struct vfsmount *mnt; > > + int ret; > > + > > + BUG_ON(!d_inode(mntpt)); > > + > > + fc = vfs_new_fs_context(&afs_fs_type, mntpt, 0, > > + FS_CONTEXT_FOR_SUBMOUNT); > > + if (IS_ERR(fc)) > > + return ERR_CAST(fc); > > + > > + ret = afs_mntpt_set_params(fc, mntpt); > > + if (ret < 0) > > + goto error_fc; > > + > > + ret = vfs_get_tree(fc); > > + if (ret < 0) > > + goto error_fc; > > + > > + mnt = vfs_create_mount(fc, 0); > > + if (IS_ERR(mnt)) { > > + ret = PTR_ERR(mnt); > > + goto error_fc; > > + } > > > > - free_page((unsigned long) devname); > > - free_page((unsigned long) options); > > - _leave(" = %p", mnt); > > + put_fs_context(fc); > > return mnt; > > > Why are you performing a put_fs_context(fc) in the success code path? Do > we not need a reference of fc anymore? No. This is the ->d_automount() hook. The context is created at the top of the function, configuration is done, the superblock is obtained, a mount object is created (for which we get a ref returned). After that point, we don't need the context any more and no one else is going to clean it up for us. David