diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 1c43993e81b05fd0bf2aca42c0ddf4d222587368..b7dfac226b1e2dc517877c9402832abf4cba3530 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -1309,6 +1309,11 @@ static int ocfs2_rename(struct inode *old_dir, } parents_locked = 1; + if (!new_dir->i_nlink) { + 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) {