[linux-cifs-client] review 4, was Re: projected date for mount.cifs to support DFS junction points

Q (Igor Mammedov) qwerty0987654321 at mail.ru
Mon Jan 14 13:15:05 GMT 2008


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






More information about the linux-cifs-client mailing list