diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 07bef74cf2f344ffcce9bb04c86529f3c78be511..98d25a6995ba5be49761aec30480221114b98d31 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5604,7 +5604,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) up_write(&EXT4_I(inode)->i_data_sem); ext4_journal_stop(handle); if (error) { - if (orphan) + if (orphan && inode->i_nlink) ext4_orphan_del(NULL, inode); goto err_out; }