From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Q (Igor Mammedov)" Subject: Re: review 4, was Re: projected date for mount.cifs to support DFS junction points Date: Mon, 14 Jan 2008 16:15:05 +0300 Message-ID: <478B6059.2000204@mail.ru> References: <1199988975.7483.3.camel@gn2.draper.com> <524f69650801101228o3639363cp4c9710d747b71ead@mail.gmail.com> <20080111090749.GA14910@infradead.org> <524f69650801110805y56cdbe4nf7587e396b70f32c@mail.gmail.com> <20080113201903.GA24573@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-fsdevel , Steve French , dhowells@redhat.com, linux-cifs-client@lists.samba.org To: Christoph Hellwig Return-path: In-Reply-To: <20080113201903.GA24573@infradead.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org Errors-To: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org List-Id: linux-fsdevel.vger.kernel.org Christoph Hellwig wrote: > [David, any chance you could look at the suggestion below to refactor > the automount from ->follow_link code into a common helper now that > we've grown a second copy from it] > > > +cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) > +{ > + struct dfs_info3_param *referrals = NULL; > + unsigned int num_referrals = 0; > + struct cifs_sb_info *cifs_sb; > + struct cifsSesInfo *ses; > + char *full_path = NULL; > + int xid, i; > + int rc = 0; > + struct vfsmount *mnt = ERR_PTR(-ENOENT); > + > + cFYI(1, ("in %s", __FUNCTION__)); > + BUG_ON(IS_ROOT(dentry)); > + > + xid = GetXid(); > + > + dput(nd->dentry); > + nd->dentry = dget(dentry); > + if (d_mountpoint(nd->dentry)) > + goto out_follow; > > A link should never be a mountpoint. why link? after patch 5 are applied DFS junction point becomes directory instead of link. That is what has been done in NFS code. > + if (IS_ERR(mnt)) > + goto out_err; > + > + mntget(mnt); > + rc = do_add_mount(mnt, nd, nd->mnt->mnt_flags, > + &cifs_dfs_automount_list); > + if (rc < 0) { > + mntput(mnt); > + if (rc == -EBUSY) > + goto out_follow; > + goto out_err; > + } > + mntput(nd->mnt); > + dput(nd->dentry); > + nd->mnt = mnt; > + nd->dentry = dget(mnt->mnt_root); > > the version of the code in afs that you copy & pasted from in afs > with the switch statement looked more readable. In fact it would > probably be useful if most of this could be split into a common > helper. Actually I copy & pasted it from NFS code ... fs/nfs/namespace.c:nfs_follow_mountpoint I've tried to do submount/referral machinery in NFS code way. -- Best regards, ------------------------- Igor Mammedov, niallain "at" gmail.com