From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: a question about clone_mnt in namespace.c Date: Fri, 22 Jun 2012 10:29:24 +0100 Message-ID: <20120622092924.GC14083@ZenIV.linux.org.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: yushang Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:52756 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761836Ab2FVJ3Z (ORCPT ); Fri, 22 Jun 2012 05:29:25 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Jun 20, 2012 at 10:54:00AM +0800, yushang wrote: > Hi dear all, > I have a question about the mnt_master logic in clone_mnt , look at > following lines: > ... > } else if (!(flag & CL_PRIVATE)) { > if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old)) > list_add(&mnt->mnt_share, &old->mnt_share); > if (IS_MNT_SLAVE(old)) > list_add(&mnt->mnt_slave, &old->mnt_slave); > mnt->mnt_master = old->mnt_master; > } > ... > I think the following lines are equivalent, right ? or I've missed > something ? many thanks! > ... > } else if (!(flag & CL_PRIVATE)) { > if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old)) > list_add(&mnt->mnt_share, &old->mnt_share); > if (IS_MNT_SLAVE(old)) { > list_add(&mnt->mnt_slave, &old->mnt_slave); > mnt->mnt_master = old->mnt_master; > } > } Yes; we are guaranteed that mnt->master is NULL after alloc_vfsmnt(), so that would be an equivalent transformation. Matter of taste, mostly - performance win is negligible and IMO your variant is slightly less explicit.