All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 7/8] cifs: move unix extension call to cifs_query_symlink()
Date: Mon, 25 Nov 2013 17:09:54 +0000	[thread overview]
Message-ID: <1385399395-19217-8-git-send-email-sprabhu@redhat.com> (raw)
In-Reply-To: <1385399395-19217-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Unix extensions rigth now are only applicable to smb1 operations.
Move the check and subsequent unix extension call to the smb1
specific call to query_symlink() ie. cifs_query_symlink().

Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/link.c    |  5 +----
 fs/cifs/smb1ops.c | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index ee5ae46..67d9243 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -516,10 +516,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
 		rc = query_mf_symlink(xid, tcon, cifs_sb, full_path,
 				      &target_path);
 
-	if ((rc != 0) && cap_unix(tcon->ses))
-		rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path,
-					     cifs_sb->local_nls);
-	else if (rc != 0 && server->ops->query_symlink)
+	if (rc != 0 && server->ops->query_symlink)
 		rc = server->ops->query_symlink(xid, tcon, full_path,
 						&target_path, cifs_sb);
 
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 1470ec4..2d822dd 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -918,23 +918,31 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
 
 	cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path);
 
+	/* Check for unix extensions */
+	if (cap_unix(tcon->ses)) {
+		rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path,
+					     cifs_sb->local_nls);
+		goto out;
+	}
+
 	rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
 			 FILE_READ_ATTRIBUTES, OPEN_REPARSE_POINT, &netfid,
 			 &oplock, NULL, cifs_sb->local_nls,
 			 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
 	if (rc)
-		return rc;
+		goto out;
 
 	rc = CIFSSMBQuerySymLink(xid, tcon, netfid, target_path,
 				 cifs_sb->local_nls);
-	if (rc) {
-		CIFSSMBClose(xid, tcon, netfid);
-		return rc;
-	}
+	if (rc)
+		goto out_close;
 
 	convert_delimiter(*target_path, '/');
+out_close:
 	CIFSSMBClose(xid, tcon, netfid);
-	cifs_dbg(FYI, "%s: target path: %s\n", __func__, *target_path);
+out:
+	if (!rc)
+		cifs_dbg(FYI, "%s: target path: %s\n", __func__, *target_path);
 	return rc;
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2013-11-25 17:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 17:09 [PATCH 0/8] Clean up MF-Symlink code and add readlink support for DFS shares Sachin Prabhu
     [not found] ` <1385399395-19217-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-25 17:09   ` [PATCH 1/8] cifs: We do not drop reference to tlink in CIFSCheckMFSymlink() Sachin Prabhu
     [not found]     ` <1385399395-19217-2-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:35       ` Jeff Layton
     [not found]         ` <20131127063507.6e1a9a14-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-12-09 15:37           ` Steve French
     [not found]     ` <CAH2r5mufmo9P_qaM7g8zRtPxKW9yaZ+HMba21PUUw9odXEpzGg@mail.gmail.com>
     [not found]       ` <CAH2r5mufmo9P_qaM7g8zRtPxKW9yaZ+HMba21PUUw9odXEpzGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-09 16:23         ` Sachin Prabhu
2013-11-25 17:09   ` [PATCH 2/8] cifs: Rename and cleanup open_query_close_cifs_symlink() Sachin Prabhu
     [not found]     ` <1385399395-19217-3-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:36       ` Jeff Layton
2013-11-25 17:09   ` [PATCH 3/8] cifs: Rename MF symlink function names Sachin Prabhu
     [not found]     ` <1385399395-19217-4-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:36       ` Jeff Layton
2013-11-25 17:09   ` [PATCH 4/8] cifs: use protocol specific call for query_mf_symlink() Sachin Prabhu
     [not found]     ` <1385399395-19217-5-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:39       ` Jeff Layton
2013-11-25 17:09   ` [PATCH 5/8] cifs: Add create MFSymlinks to protocol ops struct Sachin Prabhu
     [not found]     ` <1385399395-19217-6-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:40       ` Jeff Layton
2013-11-25 17:09   ` [PATCH 6/8] cifs: Re-order M-F Symlink code Sachin Prabhu
     [not found]     ` <1385399395-19217-7-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:41       ` Jeff Layton
2013-11-25 17:09   ` Sachin Prabhu [this message]
     [not found]     ` <1385399395-19217-8-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:41       ` [PATCH 7/8] cifs: move unix extension call to cifs_query_symlink() Jeff Layton
2013-11-25 17:09   ` [PATCH 8/8] cifs: Add support for readlink on dfs shares under posix extensions Sachin Prabhu
     [not found]     ` <1385399395-19217-9-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 11:45       ` Jeff Layton
     [not found]         ` <20131127064551.7a8b77a2-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-11-27 12:58           ` Sachin Prabhu
2013-11-27 13:05             ` Jeff Layton
2013-11-27 17:10       ` Christoph Hellwig
2013-11-27 13:27   ` [PATCH 7/8 v2] cifs: move unix extension call to cifs_query_symlink() Sachin Prabhu
2013-11-27 13:27   ` [PATCH 8/8 v2] cifs: Add support for readlink on dfs shares under posix extensions Sachin Prabhu
     [not found]     ` <1385558835-7990-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-02 16:41       ` Sachin Prabhu
2013-12-02 16:37   ` [PATCH 8/8 v3] cifs: Add support for follow_link " Sachin Prabhu
2014-01-20  6:44   ` [PATCH 0/8] Clean up MF-Symlink code and add readlink support for DFS shares 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=1385399395-19217-8-git-send-email-sprabhu@redhat.com \
    --to=sprabhu-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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.