summaryrefslogtreecommitdiffstats
path: root/fs/cifs/link.c
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2012-08-03 08:43:01 -0500
committerSteve French <smfrench@gmail.com>2012-08-19 22:30:00 -0500
commitb7ca69289680cf631fb20b7d436467c4ec1153cd (patch)
tree94c52c03ebf4efa68cb52df5aa60b554cf6cf999 /fs/cifs/link.c
parent6dab7ede9390d4d937cb89feca932e4fd575d2da (diff)
downloadop-kernel-dev-b7ca69289680cf631fb20b7d436467c4ec1153cd.zip
op-kernel-dev-b7ca69289680cf631fb20b7d436467c4ec1153cd.tar.gz
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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 09e4b3a..e6ce3b1 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
OpenPOWER on IntegriCloud