Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e325a88f17196f18888f6e1426eb9fe3b4346d28
Commit:     e325a88f17196f18888f6e1426eb9fe3b4346d28
Parent:     bc7e97cbdd4bef162e5772c74ee2cc4487a2d997
Author:     Srinivas Eeda <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 31 16:49:43 2007 -0700
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Tue Nov 6 15:35:40 2007 -0800

    ocfs2: fix rename vs unlink race
    
    If another node unlinks the destination while ocfs2_rename() is waiting on a
    cluster lock, ocfs2_rename() simply logs an error and continues. This causes
    a crash because the renaming node is now trying to delete a non-existent
    inode. The correct solution is to return -ENOENT.
    
    Signed-off-by: Srinivas Eeda <[EMAIL PROTECTED]>
    Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
---
 fs/ocfs2/namei.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 7292590..989ac27 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1105,9 +1105,16 @@ static int ocfs2_rename(struct inode *old_dir,
                goto bail;
        }
 
-       if (!new_de && new_inode)
-               mlog(ML_ERROR, "inode %lu does not exist in it's parent "
-                    "directory!", new_inode->i_ino);
+       if (!new_de && new_inode) {
+               /*
+                * Target was unlinked by another node while we were
+                * waiting to get to ocfs2_rename(). There isn't
+                * anything we can do here to help the situation, so
+                * bubble up the appropriate error.
+                */
+               status = -ENOENT;
+               goto bail;
+       }
 
        /* In case we need to overwrite an existing file, we blow it
         * away first */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to