All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <niallain@gmail.com>
To: Steve French <smfrench@gmail.com>
Cc: "Q (Igor Mammedov)" <qwerty0987654321@mail.ru>,
	Jeremy Allison <jra@samba.org>, Jeff Layton <jlayton@redhat.com>,
	linux-cifs-client@lists.samba.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: dfs path construction fix - send dfs paths on all path based operations on share in dfs
Date: Fri, 16 May 2008 14:03:58 +0400	[thread overview]
Message-ID: <482D5C0E.2020007@gmail.com> (raw)
In-Reply-To: <524f69650805131545id9be81et97549c74ecd0e7c8@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

Steve French wrote:
> Samba was not handling paths without the \\server\share prefix (which
> our current code sends on QueryPathInfo) when "SHARE_IN_DFS" on
> operations such as rmdir and delete.
> 
> This patch fixes that:

A set of patches that fixes path handling (broken by 646dd539878a194) 
in the DFS related parts of code in accordance with
a new 'build_path_from_dentry' behavior.


-- 

Best regards,

-------------------------
Igor Mammedov,
niallain "at" gmail.com





[-- Attachment #2: 0002-Fixed-DFS-code-to-work-with-new-build_path_from_den.patch --]
[-- Type: text/x-patch, Size: 2335 bytes --]

>From b5a37238de56db6a99db746b169fe3deba27b510 Mon Sep 17 00:00:00 2001
From: Igor Mammedov <niallain@gmail.com>
Date: Fri, 16 May 2008 13:10:32 +0400
Subject: [PATCH] Fixed DFS code to work with new 'build_path_from_dentry', that returns
 full path if share in the dfs, now.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
 fs/cifs/cifs_dfs_ref.c |   49 +-----------------------------------------------
 1 files changed, 1 insertions(+), 48 deletions(-)

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index f6fdecf..d82374c 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -219,53 +219,6 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
 
 }
 
-static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
-{
-	char *full_path = NULL;
-	char *search_path;
-	char *tmp_path;
-	size_t l_max_len;
-	struct cifs_sb_info *cifs_sb;
-
-	if (dentry->d_inode == NULL)
-		return NULL;
-
-	cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
-
-	if (cifs_sb->tcon == NULL)
-		return NULL;
-
-	search_path = build_path_from_dentry(dentry);
-	if (search_path == NULL)
-		return NULL;
-
-	if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) {
-		int i;
-		/* we should use full path name for correct working with DFS */
-		l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
-					strnlen(search_path, MAX_PATHCONF) + 1;
-		tmp_path = kmalloc(l_max_len, GFP_KERNEL);
-		if (tmp_path == NULL) {
-			kfree(search_path);
-			return NULL;
-		}
-		strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
-		tmp_path[l_max_len-1] = 0;
-		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
-			for (i = 0; i < l_max_len; i++) {
-				if (tmp_path[i] == '\\')
-					tmp_path[i] = '/';
-			}
-		strncat(tmp_path, search_path, l_max_len - strlen(tmp_path));
-
-		full_path = tmp_path;
-		kfree(search_path);
-	} else {
-		full_path = search_path;
-	}
-	return full_path;
-}
-
 static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
 				struct list_head *mntlist)
 {
@@ -333,7 +286,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
 		goto out_err;
 	}
 
-	full_path = build_full_dfs_path_from_dentry(dentry);
+	full_path = build_path_from_dentry(dentry);
 	if (full_path == NULL) {
 		rc = -ENOMEM;
 		goto out_err;
-- 
1.5.3.7


[-- Attachment #3: 0003-Fixed-inode-lookup-code-DFS-related-part-to-suppor.patch --]
[-- Type: text/x-patch, Size: 1473 bytes --]

>From fd33ede1ca0b157ecf26711bdf12c2b15336e0cd Mon Sep 17 00:00:00 2001
From: Igor Mammedov <niallain@gmail.com>
Date: Fri, 16 May 2008 13:24:59 +0400
Subject: [PATCH] Fixed inode lookup code (DFS related part) to support
 new build_path_from_dentry behaviour.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
 fs/cifs/inode.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 9d9b56a..c7c5242 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -184,6 +184,9 @@ try_again_CIFSSMBUnixQPathInfo:
 	if (rc) {
 		if (rc == -EREMOTE && !is_dfs_referral) {
 			is_dfs_referral = true;
+			full_path = strchr(full_path + 2, '/');
+			full_path++;
+			full_path = strchr(full_path + 2, '/');
 			goto try_again_CIFSSMBUnixQPathInfo;
 		}
 		goto cgiiu_exit;
@@ -230,6 +233,11 @@ try_again_CIFSSMBUnixQPathInfo:
 			(unsigned long) inode->i_size,
 			(unsigned long long)inode->i_blocks));
 
+		if (is_dfs_referral && ((inode->i_mode & S_IFMT) == S_IFLNK)) {
+			inode->i_mode &= ~S_IFLNK;
+			inode->i_mode |= S_IFDIR;
+		}
+
 		cifs_set_ops(inode, is_dfs_referral);
 	}
 cgiiu_exit:
@@ -389,6 +397,9 @@ try_again_CIFSSMBQPathInfo:
 	if (rc) {
 		if (rc == -EREMOTE && !is_dfs_referral) {
 			is_dfs_referral = true;
+			full_path = strchr(full_path + 2, '\\');
+			full_path++;
+			full_path = strchr(full_path + 2, '\\');
 			goto try_again_CIFSSMBQPathInfo;
 		}
 		goto cgii_exit;
-- 
1.5.3.7


      parent reply	other threads:[~2008-05-16 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13 22:45 dfs path construction fix - send dfs paths on all path based operations on share in dfs Steve French
2008-05-14 11:50 ` Igor Mammedov
     [not found]   ` <524f69650805141150u3975b19al9b33f76378b28be3@mail.gmail.com>
     [not found]     ` <524f69650805141853t2ca20b25hd8fa79d698445a62@mail.gmail.com>
2008-05-15  6:22       ` Steve French
2008-05-16 10:03 ` Igor Mammedov [this message]

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=482D5C0E.2020007@gmail.com \
    --to=niallain@gmail.com \
    --cc=jlayton@redhat.com \
    --cc=jra@samba.org \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=qwerty0987654321@mail.ru \
    --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.