Skip to contentSkip to conversation

btrfs:Fix incorrect return statement if failure occurs in the function btrfs_mark_extent_written

PATCH RESEND Chris Mason 1 participant 1 message Dec 30, 2015 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 17 lines · Nicholas Krause

This fixes the incorrect return statement if failure occurs by returning 0 rather then the variable ret which may hold a error code to signal when a failure has occurred in the function btrfs_mark_extent_written to its callers rather then always making this function appear to run successfully to its callers by always returning zero.

---
 fs/btrfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/file.c +0 -0
index b823fac..7a9ab8e 100644

fs/btrfs/file.c again: · line 1280

Quoted 6 lines
fs/btrfs/file.c +1 -1
@@ -1276,7 +1276,7 @@ again:
 	}
 out:
 	btrfs_free_path(path);
-	return 0;
+	return ret;
 }

We're checking ret higher up and aborting the transaction properly. There is at least one place ret will be non-zero above that isn't an error, but you're passing it to the caller here making them think it has gone wrong.

-chris