From: Miklos Szeredi Date: Mon, 4 Feb 2013 14:57:42 +0000 (+0100) Subject: fuse: don't WARN when nlink is zero X-Git-Tag: v3.8.2~20 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=c205ae0e166fa0fdfdfb2cb55a4fc597b0dd68be;p=unionfs-2.6.39.y.git fuse: don't WARN when nlink is zero commit dfca7cebc2679f3d129f8e680a8f199a7ad16e38 upstream. drop_nlink() warns if nlink is already zero. This is triggerable by a buggy userspace filesystem. The cure, I think, is worse than the disease so disable the warning. Reported-by: Tero Roponen Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index b7c09f9eb40..315e1f80ce7 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -682,7 +682,14 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) spin_lock(&fc->lock); fi->attr_version = ++fc->attr_version; - drop_nlink(inode); + /* + * If i_nlink == 0 then unlink doesn't make sense, yet this can + * happen if userspace filesystem is careless. It would be + * difficult to enforce correct nlink usage so just ignore this + * condition here + */ + if (inode->i_nlink > 0) + drop_nlink(inode); spin_unlock(&fc->lock); fuse_invalidate_attr(inode); fuse_invalidate_attr(dir);