From c43be1085f8480ab36d5c8c76a08e67bdf6d2e18 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 7 Feb 2012 10:58:51 +0200 Subject: [PATCH] UBIFS: do not use inc_link when i_nlink is zero This patch changes the 'i_nlink' counter handling in 'ubifs_unlink()', 'ubifs_rmdir()' and 'ubifs_rename()'. In these function 'i_nlink' may become 0, and if 'ubifs_jnl_update()' failed, we would use 'inc_nlink()' to restore the previous 'i_nlink' value, which is incorrect from the VFS point of view and would cause a 'WARN_ON()' (see 'inc_nlink() implementation). This patches saves the previous 'i_nlink' value in a local variable and uses it at the error path instead of calling 'inc_nlink()'. We do this only for the inodes where 'i_nlink' may potentially become zero. This change has been requested by Al Viro . Signed-off-by: Artem Bityutskiy --- Reading git-format-patch failed