From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753293Ab0EMGXp (ORCPT ); Thu, 13 May 2010 02:23:45 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:57256 "EHLO e28smtp03.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570Ab0EMGXo (ORCPT ); Thu, 13 May 2010 02:23:44 -0400 From: "Aneesh Kumar K. V" To: Dave Chinner , Andreas Dilger Cc: hch@infradead.org, viro@zeniv.linux.org.uk, adilger@Sun.COM, corbet@lwn.net, serue@us.ibm.com, neilb@suse.de, linux-fsdevel@vger.kernel.org, sfrench@us.ibm.com, philippe.deniel@CEA.FR, linux-kernel@vger.kernel.org Subject: Re: [PATCH -V7 3/9] vfs: Add name to file handle conversion support In-Reply-To: <20100513002038.GE13617@dastard> References: <1273679444-14903-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1273679444-14903-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <20100513002038.GE13617@dastard> User-Agent: Notmuch/ (http://notmuchmail.org) Emacs/24.0.50.1 (i686-pc-linux-gnu) Date: Thu, 13 May 2010 11:53:33 +0530 Message-ID: <87y6fo1fru.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 May 2010 10:20:38 +1000, Dave Chinner wrote: > On Wed, May 12, 2010 at 03:49:49PM -0600, Andreas Dilger wrote: > > On 2010-05-12, at 09:50, Aneesh Kumar K.V wrote: > > > +static long do_sys_name_to_handle(struct path *path, > > > + struct file_handle __user *ufh) > > > +{ > > > + if (handle_size <= f_handle.handle_size) { > > > + /* get the uuid */ > > > + retval = sb->s_op->get_fsid(sb, &this_fs_id); > > > + if (!retval) { > > > + /* > > > + * Now verify whether we get the same vfsmount > > > + * if we lookup with uuid. In case we end up having > > > + * same uuid for the multiple file systems. When doing > > > + * uuid based lookup we would return the first one.So > > > + * with name_to_handle if we don't find the same > > > + * vfsmount with lookup return EOPNOTSUPP > > > + */ > > > + mnt = fs_get_vfsmount(current, &this_fs_id); > > > + if (mnt != path->mnt) { > > > + retval = -EOPNOTSUPP; > > > + mntput(mnt); > > > + goto err_free_out; > > > + } > > > > I don't see that this does anything for us except add overhead. > > This is no protection against mounting a second filesystem with > > the same UUID after the handle is returned, since there is no > > expiration for file handles. > > > > At best I think we could start by changing the list-based UUID > > lookup with a hash-based one, and when adding a duplicate UUID at > > mount time start by printing out an error message to the console > > in case of duplicated UUIDs, and maybe at some point in the future > > this might cause the mount to fail (though I don't think we can > > make that decision lightly or quickly). > > > > That moves the overhead to mount time instead of for each > > name_to_handle() call (which would be brutal for a system with > > many filesystems mounted). > > That will pretty much match exactly what XFS already does. Can we > start by moving the XFS functionality (xfs_uuid_mount(), "nouuid" > mount option, etc) to the VFS level and then optimise from there? > I will do this. But should the uuid be unique in a system wide manner or should it be unique for a mount namespace ? With containers isn't it valid for the second container to mount a file system with same uuid of a file system in the first container, but uuid itself is unique in the second container ? -aneesh