diff options
-rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
-rw-r--r-- | fs/ext4/namei.c | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e1683829b2b5..180111de2302 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2199,6 +2199,7 @@ extern int ext4_generic_delete_entry(handle_t *handle, | |||
2199 | void *entry_buf, | 2199 | void *entry_buf, |
2200 | int buf_size, | 2200 | int buf_size, |
2201 | int csum_size); | 2201 | int csum_size); |
2202 | extern int ext4_empty_dir(struct inode *inode); | ||
2202 | 2203 | ||
2203 | /* resize.c */ | 2204 | /* resize.c */ |
2204 | extern int ext4_group_add(struct super_block *sb, | 2205 | extern int ext4_group_add(struct super_block *sb, |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 23a0b9bf822d..0dbd2d2937f7 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2457,7 +2457,7 @@ out_stop: | |||
2457 | /* | 2457 | /* |
2458 | * routine to check that the specified directory is empty (for rmdir) | 2458 | * routine to check that the specified directory is empty (for rmdir) |
2459 | */ | 2459 | */ |
2460 | static int empty_dir(struct inode *inode) | 2460 | int ext4_empty_dir(struct inode *inode) |
2461 | { | 2461 | { |
2462 | unsigned int offset; | 2462 | unsigned int offset; |
2463 | struct buffer_head *bh; | 2463 | struct buffer_head *bh; |
@@ -2725,7 +2725,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
2725 | goto end_rmdir; | 2725 | goto end_rmdir; |
2726 | 2726 | ||
2727 | retval = -ENOTEMPTY; | 2727 | retval = -ENOTEMPTY; |
2728 | if (!empty_dir(inode)) | 2728 | if (!ext4_empty_dir(inode)) |
2729 | goto end_rmdir; | 2729 | goto end_rmdir; |
2730 | 2730 | ||
2731 | handle = ext4_journal_start(dir, EXT4_HT_DIR, | 2731 | handle = ext4_journal_start(dir, EXT4_HT_DIR, |
@@ -3285,7 +3285,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3285 | if (S_ISDIR(old.inode->i_mode)) { | 3285 | if (S_ISDIR(old.inode->i_mode)) { |
3286 | if (new.inode) { | 3286 | if (new.inode) { |
3287 | retval = -ENOTEMPTY; | 3287 | retval = -ENOTEMPTY; |
3288 | if (!empty_dir(new.inode)) | 3288 | if (!ext4_empty_dir(new.inode)) |
3289 | goto end_rename; | 3289 | goto end_rename; |
3290 | } else { | 3290 | } else { |
3291 | retval = -EMLINK; | 3291 | retval = -EMLINK; |
@@ -3359,8 +3359,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3359 | 3359 | ||
3360 | ext4_dec_count(handle, old.dir); | 3360 | ext4_dec_count(handle, old.dir); |
3361 | if (new.inode) { | 3361 | if (new.inode) { |
3362 | /* checked empty_dir above, can't have another parent, | 3362 | /* checked ext4_empty_dir above, can't have another |
3363 | * ext4_dec_count() won't work for many-linked dirs */ | 3363 | * parent, ext4_dec_count() won't work for many-linked |
3364 | * dirs */ | ||
3364 | clear_nlink(new.inode); | 3365 | clear_nlink(new.inode); |
3365 | } else { | 3366 | } else { |
3366 | ext4_inc_count(handle, new.dir); | 3367 | ext4_inc_count(handle, new.dir); |