Btrfs: fix error handling in btrfs_truncate()
[sfrench/cifs-2.6.git] / fs / btrfs / inode.c
index 8e604e7071f14cf166652369e6f167fab5b5f462..d82afca0c05f092f51b89eb4c69207e92106fb60 100644 (file)
@@ -9124,7 +9124,8 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)
                                                 BTRFS_EXTENT_DATA_KEY);
                trans->block_rsv = &fs_info->trans_block_rsv;
                if (ret != -ENOSPC && ret != -EAGAIN) {
-                       err = ret;
+                       if (ret < 0)
+                               err = ret;
                        break;
                }