ext4: do not delete unlinked inode from orphan list on failed truncate
[platform/kernel/linux-rpi.git] / fs / ext4 / inode.c
index 67e8aa3..82dee8a 100644 (file)
@@ -5596,7 +5596,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;
                        }