Message ID | 55d79af5.vof3qQ+dtZ/KFVyv%akpm@linux-foundation.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff -puN fs/ocfs2/namei.c~ocfs2-fix-a-tiny-case-that-inode-can-not-removed fs/ocfs2/namei.c --- a/fs/ocfs2/namei.c~ocfs2-fix-a-tiny-case-that-inode-can-not-removed +++ a/fs/ocfs2/namei.c @@ -1284,6 +1284,15 @@ static int ocfs2_rename(struct inode *ol } parents_locked = 1; + if (!new_dir->i_nlink) { + mlog(ML_ERROR, "new dir %llu has been removed, inode %llu " + "can not be moved into it.", + (unsigned long long)new_dir->i_ino, + (unsigned long long)old_inode->i_ino); + status = -EACCES; + goto bail; + } + /* make sure both dirs have bhs * get an extra ref on old_dir_bh if old==new */ if (!new_dir_bh) {