From: Miklos Szeredi <miklos@szeredi.hu>
To: Trond.Myklebust@netapp.com
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [patch 1/4] nfs: remove unnecessary check from nfs_rename()
Date: Wed, 02 Dec 2009 16:04:55 +0100 [thread overview]
Message-ID: <20091202150510.757093350@szeredi.hu> (raw)
In-Reply-To: 20091202150454.616582634@szeredi.hu
[-- Attachment #1: nfs_rename_remove_unnecessary_check.patch --]
[-- Type: text/plain, Size: 1200 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
VFS already checks if both source and target are directories.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/nfs/dir.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Index: linux-2.6/fs/nfs/dir.c
===================================================================
--- linux-2.6.orig/fs/nfs/dir.c 2009-12-02 13:46:12.000000000 +0100
+++ linux-2.6/fs/nfs/dir.c 2009-12-02 15:10:33.000000000 +0100
@@ -1601,13 +1601,8 @@ static int nfs_rename(struct inode *old_
* silly-rename. If the silly-rename succeeds, the
* copied dentry is hashed and becomes the new target.
*/
- if (!new_inode)
- goto go_ahead;
- if (S_ISDIR(new_inode->i_mode)) {
- error = -EISDIR;
- if (!S_ISDIR(old_inode->i_mode))
- goto out;
- } else if (atomic_read(&new_dentry->d_count) > 2) {
+ if (new_inode && !S_ISDIR(new_inode->i_mode) &&
+ atomic_read(&new_dentry->d_count) > 2) {
int err;
/* copy the target dentry's name */
dentry = d_alloc(new_dentry->d_parent,
@@ -1627,7 +1622,6 @@ static int nfs_rename(struct inode *old_
goto out;
}
-go_ahead:
/*
* ... prune child dentries and writebacks if needed.
*/
--
next prev parent reply other threads:[~2009-12-02 15:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 15:04 [patch 0/4] nfs: cleanups in nfs_rename() Miklos Szeredi
2009-12-02 15:04 ` Miklos Szeredi [this message]
2009-12-02 15:04 ` [patch 2/4] nfs: fix comments " Miklos Szeredi
2009-12-02 15:04 ` [patch 3/4] nfs: dont unhash target if renaming a directory Miklos Szeredi
2009-12-02 15:04 ` [patch 4/4] nfs: clean up sillyrenaming in nfs_rename() Miklos Szeredi
2009-12-26 6:24 ` hooanon05
2009-12-27 21:32 ` OGAWA Hirofumi
2009-12-02 20:33 ` [patch 0/4] nfs: cleanups " Trond Myklebust
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=20091202150510.757093350@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=Trond.Myklebust@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).