From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: [PATCH 6/6] locks: break delegations on link Date: Fri, 3 Feb 2012 16:09:57 -0500 Message-ID: <1328303397-3872-7-git-send-email-bfields@redhat.com> References: <20120203205818.GE2999@fieldses.org> Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Christoph Hellwig , "J. Bruce Fields" To: Al Viro Return-path: In-Reply-To: <20120203205818.GE2999-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org From: "J. Bruce Fields" Signed-off-by: J. Bruce Fields --- fs/namei.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 1e0c383..b8f3cbd 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2920,8 +2920,11 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de /* Make sure we don't allow creating hardlink to an unlinked file */ if (inode->i_nlink == 0) error = -ENOENT; - else - error = dir->i_op->link(old_dentry, dir, new_dentry); + else { + error = break_lease(inode, BREAK_ONLY_DELEGS|BREAK_R_AND_W_LEASES); + if (!error) + error = dir->i_op->link(old_dentry, dir, new_dentry); + } mutex_unlock(&inode->i_mutex); if (!error) fsnotify_link(dir, inode, new_dentry); -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html