From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ram Pai Subject: Re: [PATCH 01/34] VFS: Make clone_mnt() and copy_tree() return error codes Date: Thu, 30 Sep 2010 18:58:57 -0700 Message-ID: <20101001015857.GA5003@ram-laptop> References: <1284675145-4391-1-git-send-email-vaurora@redhat.com> <1284675145-4391-2-git-send-email-vaurora@redhat.com> <20100930214123.GA490@shell> <20100930214418.GB490@shell> <20101001003342.GI9247@ram-laptop> Reply-To: Ram Pai Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Valerie Aurora , Miklos Szeredi , viro@zeniv.linux.org.uk, hch@infradead.org, agruen@suse.de, npiggin@kernel.dk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Ram Pai Return-path: Received: from e9.ny.us.ibm.com ([32.97.182.139]:38804 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952Ab0JAB7G (ORCPT ); Thu, 30 Sep 2010 21:59:06 -0400 Content-Disposition: inline In-Reply-To: <20101001003342.GI9247@ram-laptop> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Sep 30, 2010 at 05:33:42PM -0700, Ram Pai wrote: > On Thu, Sep 30, 2010 at 05:44:18PM -0400, Valerie Aurora wrote: > > (Resend with correct email for Ram Pai) > > > > On Thu, Sep 30, 2010 at 11:51:30AM +0200, Miklos Szeredi wrote: > > > On Thu, 16 Sep 2010, Valerie Aurora wrote: > > > > copy_tree() can theoretically fail in a case other than ENOMEM, but > > > > always returns NULL which is interpreted by callers as -ENOMEM. > > > > Convert to return an explicit error. Convert clone_mnt() for > > > > consistency and because union mounts will add new error cases. > > > > > > I think it makes sense to push this fix to 2.6.37 independently of the > > > other patches. > > > > > > Acked-by: Miklos Szeredi > > > > I'm certainly not going to argue, but I spent an hour trying to > > trigger the non-ENOMEM case (below) and failed - maybe it's > > unreachable? > > > > > > @@ -1212,11 +1216,12 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry, > > > > struct path path; > > > > > > > > if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt)) > > > > - return NULL; > > > > + return ERR_PTR(-EINVAL); > > > > Ram, do you remember how this worked? > > Oops. That should be a OR condition. there is one other check in that > function that should also be a OR condition. I may be wrong here. Can't exactly recollect what CL_COPY_ALL flag means. Al Viro might remember? If CL_COPY_ALL means, to clone everything irrespective of any other flags, then the above code seems right. > > BTW: the return value has to be NULL. right? because its not an error > to clone a unbindable mount. Nor is it an error to not specify CL_COPY_ALL. > It just means that you want nothing in return. In any case i think the return value should be NULL. RP