From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trond Myklebust Subject: Re: [PATCH] permit fs->get_sb() to return alternative root Date: Tue, 18 May 2004 10:43:14 -0400 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1084891394.5215.6.camel@lade.trondhjem.org> References: <6086.1084889689@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexander Viro , Linus Torvalds , linux-fsdevel@vger.kernel.org Return-path: Received: from dh132.citi.umich.edu ([141.211.133.132]:902 "EHLO lade.trondhjem.org") by vger.kernel.org with ESMTP id S263448AbUEROnS convert rfc822-to-8bit (ORCPT ); Tue, 18 May 2004 10:43:18 -0400 To: David Howells In-Reply-To: <6086.1084889689@redhat.com> List-Id: linux-fsdevel.vger.kernel.org P=E5 ty , 18/05/2004 klokka 10:14, skreiv David Howells: > Hi Al, Linux, >=20 > Here's a patch to add an extra argument to the get_sb() method of str= uct > file_system_type that allows a filesystem to suggest an alternative d= entry to > be attached to the vfsmount structure. If no such suggestion is made, > sb->s_root is selected as usual. Cool.. > @@ -762,15 +763,18 @@ > } > } > =20 > - sb =3D type->get_sb(type, flags, name, data); > + root =3D NULL; > + sb =3D type->get_sb(type, flags, name, data, &root); > if (IS_ERR(sb)) > goto out_free_secdata; > + if (!root) > + root =3D sb->s_root; > error =3D security_sb_kern_mount(sb, secdata); > if (error) > goto out_sb; > mnt->mnt_sb =3D sb; > - mnt->mnt_root =3D dget(sb->s_root); > - mnt->mnt_mountpoint =3D sb->s_root; > + mnt->mnt_root =3D dget(root); > + mnt->mnt_mountpoint =3D mnt->mnt_root; This looks a bit iffy... Shouldn't that be + if (!root) + root =3D dget(sb->s_root); =2E... + mnt->mnt_root =3D root; Unless the filesystem has taken a reference to the dentry in "root", it just won't be guaranteed to still exist. Cheers, Trond - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html