diff options
author | Steve French <smfrench@gmail.com> | 2012-08-03 08:43:01 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-08-19 22:30:00 -0500 |
commit | b7ca69289680cf631fb20b7d436467c4ec1153cd (patch) | |
tree | 94c52c03ebf4efa68cb52df5aa60b554cf6cf999 /fs/cifs/link.c | |
parent | 6dab7ede9390d4d937cb89feca932e4fd575d2da (diff) |
CIFS: Protect i_nlink from being negative
that can cause warning messages. Pavel had initially
suggested a smaller patch around drop_nlink, after
a similar problem was discovered NFS. Protecting
additional places where nlink is touched was
suggested by Jeff Layton and is included in this.
Reviewed-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/link.c')
-rw-r--r-- | fs/cifs/link.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 09e4b3ae4564..e6ce3b112875 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -433,7 +433,9 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, if (old_file->d_inode) { cifsInode = CIFS_I(old_file->d_inode); if (rc == 0) { + spin_lock(&old_file->d_inode->i_lock); inc_nlink(old_file->d_inode); + spin_unlock(&old_file->d_inode->i_lock); /* BB should we make this contingent on superblock flag NOATIME? */ /* old_file->d_inode->i_ctime = CURRENT_TIME;*/ /* parent dir timestamps will update from srv |