All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Steve French <smfrench@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-cifs-client@lists.samba.org, sfrench@us.ibm.com,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	dhowells@redhat.com
Subject: review 4, was Re: projected date for mount.cifs to support DFS junction points
Date: Sun, 13 Jan 2008 20:19:03 +0000	[thread overview]
Message-ID: <20080113201903.GA24573@infradead.org> (raw)
In-Reply-To: <524f69650801110805y56cdbe4nf7587e396b70f32c@mail.gmail.com>

[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]


+	if (cifs_sb->tcon->Flags & 0x2) {

Please don't use magic numbers but symbolic defines.


+static void*

static void *

+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.

+	if (dentry->d_inode == NULL) {
+		rc = -EINVAL;
+		goto out_err;
+	}

d_inode can never be NULL if ->follow_inode, which is quite obvious
from how it's called.

+
+		/* connect to storage node */
+		if (referrals[i].flags & DFSREF_STORAGE_SERVER) {
+			int len;
+			len = strlen(referrals[i].node_name);
+			if (len < 2) {
+				cERROR(1, ("%s: Net Address path too short: %s",
+					__FUNCTION__, referrals[i].node_name));
+				rc = -EINVAL;
+				goto out_err;
+			} else {

your's jumping out with a goto here, so please remove the superflous
else and go down one indentation level to make the code more readable.

+	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.


+#ifdef CONFIG_CIFS_DFS_UPCALL
+	mark_mounts_for_expiry(&cifs_dfs_automount_list);
+	mark_mounts_for_expiry(&cifs_dfs_automount_list);
+	shrink_submounts(vfsmnt, &cifs_dfs_automount_list);
+#endif

Should be a helper that can be stubbed out.

  parent reply	other threads:[~2008-01-13 20:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1199988975.7483.3.camel@gn2.draper.com>
2008-01-10 20:28 ` projected date for mount.cifs to support DFS junction points Steve French
2008-01-11  9:07   ` Christoph Hellwig
2008-01-11 16:05     ` Steve French
2008-01-13 19:40       ` review 1, was " Christoph Hellwig
2008-01-13 21:26         ` Steve French
2008-01-13 19:48       ` review 2, " Christoph Hellwig
2008-01-13 21:35         ` Steve French
2008-01-13 19:50       ` review 3, " Christoph Hellwig
2008-01-13 20:19       ` Christoph Hellwig [this message]
2008-01-14 13:15         ` review 4, " Q (Igor Mammedov)
2008-01-14 21:53           ` [linux-cifs-client] " Christoph Hellwig
2008-01-13 20:21       ` review 5, " Christoph Hellwig
2008-02-15 16:37         ` Q (Igor Mammedov)
2008-02-15 17:05           ` [linux-cifs-client] " Christoph Hellwig
2008-02-15 21:02             ` Steve French
2008-02-15 22:11               ` [linux-cifs-client] " Christoph Hellwig
2008-02-19  4:51                 ` Steve French
2008-02-25 20:25                 ` Steve French
2008-03-08 18:43                   ` Christoph Hellwig
2008-03-11  3:34                     ` Steve French
2008-03-11 12:39                       ` Jeff Layton
2008-03-17  3:14                         ` [linux-cifs-client] " simo
2008-02-16  8:51               ` Re[2]: " Q
2008-02-16 13:32                 ` Christoph Hellwig
2008-03-04 12:38           ` Q (Igor Mammedov)
2008-03-08 18:41             ` [linux-cifs-client] " Christoph Hellwig
2008-03-08 22:21               ` Q (Igor Mammedov)
2008-03-09  3:49                 ` [linux-cifs-client] " Steve French
2008-03-10  6:14                 ` Christoph Hellwig
2008-03-10 16:20                   ` Steve French
2008-03-11  9:41                     ` Q (Igor Mammedov)
2008-03-11 22:14                       ` Steve French
2008-03-12  9:28                         ` Q (Igor Mammedov)
2008-03-22 22:48                       ` [linux-cifs-client] " Steve French
2008-04-18 16:40                         ` Igor Mammedov
2008-02-06  4:07     ` Christoph Hellwig
2008-02-06 13:43       ` Steve French
2008-02-07 18:25         ` Christoph Hellwig
2008-02-07 23:30           ` Steve French
2008-02-08  5:27           ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080113201903.GA24573@infradead.org \
    --to=hch@infradead.org \
    --cc=dhowells@redhat.com \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sfrench@us.ibm.com \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.