From: Jeff Layton <jlayton@redhat.com>
To: linux-cifs-client@lists.samba.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 13/13] cifs: remove "hardlink detection" from cifs_rename
Date: Wed, 13 May 2009 16:04:54 -0400 [thread overview]
Message-ID: <1242245094-7319-14-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1242245094-7319-1-git-send-email-jlayton@redhat.com>
Because cifs never handled hardlinks correctly, there was a rather
nasty hack in cifs_rename to try and detect them. It only ever worked
on POSIX mounts anyway. Now that cifs has proper hardlink detection,
that can be removed.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/cifs/inode.c | 60 +------------------------------------------------------
1 files changed, 1 insertions(+), 59 deletions(-)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index f13a5ef..d152fe1 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1295,29 +1295,11 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
{
char *fromName = NULL;
char *toName = NULL;
- struct cifs_sb_info *cifs_sb_source;
- struct cifs_sb_info *cifs_sb_target;
- struct cifsTconInfo *tcon;
- FILE_UNIX_BASIC_INFO *info_buf_source = NULL;
- FILE_UNIX_BASIC_INFO *info_buf_target;
int xid, rc, tmprc;
- cifs_sb_target = CIFS_SB(target_dir->i_sb);
- cifs_sb_source = CIFS_SB(source_dir->i_sb);
- tcon = cifs_sb_source->tcon;
-
xid = GetXid();
/*
- * BB: this might be allowed if same server, but different share.
- * Consider adding support for this
- */
- if (tcon != cifs_sb_target->tcon) {
- rc = -EXDEV;
- goto cifs_rename_exit;
- }
-
- /*
* we already have the rename sem so we do not need to
* grab it again here to protect the path integrity
*/
@@ -1336,46 +1318,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
rc = cifs_do_rename(xid, source_dentry, fromName,
target_dentry, toName);
- if (rc == -EEXIST && tcon->unix_ext) {
- /*
- * Are src and dst hardlinks of same inode? We can
- * only tell with unix extensions enabled
- */
- info_buf_source =
- kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO),
- GFP_KERNEL);
- if (info_buf_source == NULL) {
- rc = -ENOMEM;
- goto cifs_rename_exit;
- }
-
- info_buf_target = info_buf_source + 1;
- tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName,
- info_buf_source,
- cifs_sb_source->local_nls,
- cifs_sb_source->mnt_cifs_flags &
- CIFS_MOUNT_MAP_SPECIAL_CHR);
- if (tmprc != 0)
- goto unlink_target;
-
- tmprc = CIFSSMBUnixQPathInfo(xid, tcon,
- toName, info_buf_target,
- cifs_sb_target->local_nls,
- /* remap based on source sb */
- cifs_sb_source->mnt_cifs_flags &
- CIFS_MOUNT_MAP_SPECIAL_CHR);
-
- if (tmprc == 0 && (info_buf_source->UniqueId ==
- info_buf_target->UniqueId)) {
- /* same file, POSIX says that this is a noop */
- rc = 0;
- goto cifs_rename_exit;
- }
- } /* else ... BB we could add the same check for Windows by
- checking the UniqueId via FILE_INTERNAL_INFO */
-
-unlink_target:
- /* Try unlinking the target dentry if it's not negative */
+ /* unlink the target, but only if it looks like the file exists */
if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) {
tmprc = cifs_unlink(target_dir, target_dentry);
if (tmprc)
@@ -1386,7 +1329,6 @@ unlink_target:
}
cifs_rename_exit:
- kfree(info_buf_source);
kfree(fromName);
kfree(toName);
FreeXid(xid);
--
1.6.2.2
next prev parent reply other threads:[~2009-05-13 20:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 20:04 [PATCH 00/13] cifs: implement proper hardlink detection (try #3) Jeff Layton
2009-05-13 20:04 ` [PATCH 01/13] cifs: have cifs_NTtimeToUnix take a little-endian arg Jeff Layton
2009-05-19 14:06 ` Christoph Hellwig
2009-05-13 20:04 ` [PATCH 02/13] cifs: make cnvrtDosUnixTm take a little-endian args and an offset Jeff Layton
2009-05-19 14:06 ` Christoph Hellwig
2009-05-13 20:04 ` [PATCH 03/13] cifs: reorganize get_cifs_acl Jeff Layton
2009-05-13 20:04 ` [PATCH 04/13] cifs: clean up set_cifs_acl interfaces Jeff Layton
2009-05-14 2:53 ` [linux-cifs-client] " Shirish Pargaonkar
2009-05-14 12:21 ` Jeff Layton
2009-05-14 12:38 ` Shirish Pargaonkar
2009-05-13 20:04 ` [PATCH 05/13] cifs: rename cifs_iget to cifs_root_iget Jeff Layton
2009-05-19 14:08 ` [linux-cifs-client] " Christoph Hellwig
2009-05-13 20:04 ` [PATCH 06/13] cifs: add new cifs_iget function and convert unix codepath to use it Jeff Layton
2009-05-13 20:04 ` [PATCH 07/13] cifs: convert posix readdir codepath to use cifs_iget Jeff Layton
2009-05-13 20:04 ` [PATCH 08/13] cifs: convert cifs_get_inode_info " Jeff Layton
2009-05-13 20:04 ` [PATCH 09/13] cifs: convert non-posix readdir codepath " Jeff Layton
2009-05-13 20:04 ` [PATCH 10/13] cifs: remove cifs_new_inode Jeff Layton
2009-05-13 20:04 ` [PATCH 11/13] cifs: make serverino the default when mounting Jeff Layton
2009-05-13 20:04 ` [PATCH 12/13] cifs: remove cifsInodeInfo->inUse counter Jeff Layton
2009-05-13 20:04 ` Jeff Layton [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-05-27 12:30 [PATCH 00/13] cifs: implement proper hardlink handling (try #4) Jeff Layton
2009-05-27 12:30 ` [PATCH 13/13] cifs: remove "hardlink detection" from cifs_rename Jeff Layton
2009-05-11 20:24 [PATCH 00/13] cifs: implement proper hardlink detection Jeff Layton
2009-05-11 20:24 ` [PATCH 13/13] cifs: remove "hardlink detection" from cifs_rename Jeff Layton
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=1242245094-7319-14-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-cifs-client@lists.samba.org \
--cc=linux-fsdevel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).