diff options
-rw-r--r-- | fs/ocfs2/namei.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 67113cfddc9b..58c318d2f061 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -834,10 +834,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
834 | child_locked = 1; | 834 | child_locked = 1; |
835 | 835 | ||
836 | if (S_ISDIR(inode->i_mode)) { | 836 | if (S_ISDIR(inode->i_mode)) { |
837 | if (!ocfs2_empty_dir(inode)) { | 837 | if (inode->i_nlink != 2 || !ocfs2_empty_dir(inode)) { |
838 | status = -ENOTEMPTY; | ||
839 | goto leave; | ||
840 | } else if (inode->i_nlink != 2) { | ||
841 | status = -ENOTEMPTY; | 838 | status = -ENOTEMPTY; |
842 | goto leave; | 839 | goto leave; |
843 | } | 840 | } |
@@ -1280,8 +1277,8 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1280 | 1277 | ||
1281 | if (target_exists) { | 1278 | if (target_exists) { |
1282 | if (S_ISDIR(new_inode->i_mode)) { | 1279 | if (S_ISDIR(new_inode->i_mode)) { |
1283 | if (!ocfs2_empty_dir(new_inode) || | 1280 | if (new_inode->i_nlink != 2 || |
1284 | new_inode->i_nlink != 2) { | 1281 | !ocfs2_empty_dir(new_inode)) { |
1285 | status = -ENOTEMPTY; | 1282 | status = -ENOTEMPTY; |
1286 | goto bail; | 1283 | goto bail; |
1287 | } | 1284 | } |