[PATCH 6/6] leases: break read leases on link
J. Bruce Fields
bfields at redhat.com
Wed Sep 21 08:58:17 MDT 2011
Signed-off-by: J. Bruce Fields <bfields at redhat.com>
---
fs/namei.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index c0220f7..f6de42d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2904,8 +2904,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, O_WRONLY);
+ 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.4.1
More information about the samba-technical
mailing list