linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series
@ 2021-02-01  8:52 Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 1/3] btrfs: fix to return bool instead of int Naohiro Aota
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-02-01  8:52 UTC (permalink / raw)
  To: linux-btrfs, David Sterba
  Cc: Johannes Thumshirn, Julia Lawall, Anand Jain, Josef Bacik,
	linux-fsdevel, Naohiro Aota

Hello David,

The kernel test bot, Julia and Anand reported a lock incorrectness, a type
mis-match and a typo.

Here are the fixes.

Naohiro Aota (3):
  btrfs: fix to return bool instead of int
  btrfs: properly unlock log_mutex in error case
  btrfs: fix a typo in comment

 fs/btrfs/tree-log.c | 1 +
 fs/btrfs/volumes.c  | 8 ++++----
 fs/btrfs/zoned.c    | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH for-next 1/3] btrfs: fix to return bool instead of int
  2021-02-01  8:52 [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series Naohiro Aota
@ 2021-02-01  8:52 ` Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 2/3] btrfs: properly unlock log_mutex in error case Naohiro Aota
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-02-01  8:52 UTC (permalink / raw)
  To: linux-btrfs, David Sterba
  Cc: Johannes Thumshirn, Julia Lawall, Anand Jain, Josef Bacik,
	linux-fsdevel, Naohiro Aota, kernel test robot

The variable "changed" in dev_extent_hole_check_zoned() is using int
(0/1) to track if the hole is changed. Change it to bool to match the
definition of the function.

Fixes: 69e81c8e2824 ("btrfs: implement zoned chunk allocator")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/volumes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index fe2ed5f80804..102dc6636833 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1433,7 +1433,7 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
 	u64 zone_size = device->zone_info->zone_size;
 	u64 pos;
 	int ret;
-	int changed = 0;
+	bool changed = false;
 
 	ASSERT(IS_ALIGNED(*hole_start, zone_size));
 
@@ -1444,7 +1444,7 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
 		if (pos != *hole_start) {
 			*hole_size = *hole_start + *hole_size - pos;
 			*hole_start = pos;
-			changed = 1;
+			changed = true;
 			if (*hole_size < num_bytes)
 				break;
 		}
@@ -1459,12 +1459,12 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
 		if (ret == -ERANGE) {
 			*hole_start += *hole_size;
 			*hole_size = 0;
-			return 1;
+			return true;
 		}
 
 		*hole_start += zone_size;
 		*hole_size -= zone_size;
-		changed = 1;
+		changed = true;
 	}
 
 	return changed;
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 2/3] btrfs: properly unlock log_mutex in error case
  2021-02-01  8:52 [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 1/3] btrfs: fix to return bool instead of int Naohiro Aota
@ 2021-02-01  8:52 ` Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 3/3] btrfs: fix a typo in comment Naohiro Aota
  2021-02-01 17:48 ` [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-02-01  8:52 UTC (permalink / raw)
  To: linux-btrfs, David Sterba
  Cc: Johannes Thumshirn, Julia Lawall, Anand Jain, Josef Bacik,
	linux-fsdevel, Naohiro Aota, kernel test robot, Julia Lawall

We need to unlock log_root_tree->log_mutex in case of an error.

Fixes: 122cfba0d2eb ("btrfs: reorder log node allocation")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/tree-log.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1dd7e34fe484..ed101420934c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3164,6 +3164,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
 		ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
 		if (ret) {
 			mutex_unlock(&fs_info->tree_log_mutex);
+			mutex_unlock(&log_root_tree->log_mutex);
 			goto out;
 		}
 	}
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 3/3] btrfs: fix a typo in comment
  2021-02-01  8:52 [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 1/3] btrfs: fix to return bool instead of int Naohiro Aota
  2021-02-01  8:52 ` [PATCH for-next 2/3] btrfs: properly unlock log_mutex in error case Naohiro Aota
@ 2021-02-01  8:52 ` Naohiro Aota
  2021-02-01 17:48 ` [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-02-01  8:52 UTC (permalink / raw)
  To: linux-btrfs, David Sterba
  Cc: Johannes Thumshirn, Julia Lawall, Anand Jain, Josef Bacik,
	linux-fsdevel, Naohiro Aota

Fixes: 9e802babe329 ("btrfs: allow zoned mode on non-zoned block devices")
Reported-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 362df27040ff..746066d2fd3c 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -490,7 +490,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
 
 		model = bdev_zoned_model(device->bdev);
 		/*
-		 * A Host-Managed zoned device msut be used as a zoned
+		 * A Host-Managed zoned device must be used as a zoned
 		 * device. A Host-Aware zoned device and a non-zoned devices
 		 * can be treated as a zoned device, if ZONED flag is
 		 * enabled in the superblock.
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series
  2021-02-01  8:52 [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series Naohiro Aota
                   ` (2 preceding siblings ...)
  2021-02-01  8:52 ` [PATCH for-next 3/3] btrfs: fix a typo in comment Naohiro Aota
@ 2021-02-01 17:48 ` David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2021-02-01 17:48 UTC (permalink / raw)
  To: Naohiro Aota
  Cc: linux-btrfs, David Sterba, Johannes Thumshirn, Julia Lawall,
	Anand Jain, Josef Bacik, linux-fsdevel

On Mon, Feb 01, 2021 at 05:52:01PM +0900, Naohiro Aota wrote:
> Hello David,
> 
> The kernel test bot, Julia and Anand reported a lock incorrectness, a type
> mis-match and a typo.
> 
> Here are the fixes.
> 
> Naohiro Aota (3):
>   btrfs: fix to return bool instead of int
>   btrfs: properly unlock log_mutex in error case
>   btrfs: fix a typo in comment

Folded, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-01 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01  8:52 [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series Naohiro Aota
2021-02-01  8:52 ` [PATCH for-next 1/3] btrfs: fix to return bool instead of int Naohiro Aota
2021-02-01  8:52 ` [PATCH for-next 2/3] btrfs: properly unlock log_mutex in error case Naohiro Aota
2021-02-01  8:52 ` [PATCH for-next 3/3] btrfs: fix a typo in comment Naohiro Aota
2021-02-01 17:48 ` [PATCH for-next 0/3] Fix potential deadlock, types and typo in zoned series David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).