linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bcache: Trivial fix to bdput
@ 2020-12-21  3:17 Yi Li
  2020-12-21  5:48 ` [PATCH v2] bcache: Trivial fix to register_bcache Yi Li
  2020-12-21  7:35 ` [PATCH] bcache: Trivial fix to bdput Coly Li
  0 siblings, 2 replies; 5+ messages in thread
From: Yi Li @ 2020-12-21  3:17 UTC (permalink / raw)
  To: colyli; +Cc: yilikernel, kent.overstreet, linux-bcache, linux-kernel, Yi Li

Trivial fix to bdput.

Signed-off-by: Yi Li <yili@winhong.com>
---
 drivers/md/bcache/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index f7ad1e26b013..1756f6926098 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2525,8 +2525,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 			else
 				err = "device busy";
 			mutex_unlock(&bch_register_lock);
-			if (!IS_ERR(bdev))
-				bdput(bdev);
+			if (!IS_ERR(dev))
+				bdput(dev);
 			if (attr == &ksysfs_register_quiet)
 				goto done;
 		}
-- 
2.25.3




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

* [PATCH v2] bcache: Trivial fix to register_bcache
  2020-12-21  3:17 [PATCH] bcache: Trivial fix to bdput Yi Li
@ 2020-12-21  5:48 ` Yi Li
  2020-12-21  7:35 ` [PATCH] bcache: Trivial fix to bdput Coly Li
  1 sibling, 0 replies; 5+ messages in thread
From: Yi Li @ 2020-12-21  5:48 UTC (permalink / raw)
  To: colyli; +Cc: yilikernel, kent.overstreet, linux-bcache, linux-kernel, Yi Li

Trivial fix to no need to check the bdev and do bdput.

Fixes: 4e7b5671c6a8("block: remove i_bdev")

Signed-off-by: Yi Li <yili@winhong.com>
---
 drivers/md/bcache/super.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index f7ad1e26b013..4edf666860ad 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2525,8 +2525,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 			else
 				err = "device busy";
 			mutex_unlock(&bch_register_lock);
-			if (!IS_ERR(bdev))
-				bdput(bdev);
 			if (attr == &ksysfs_register_quiet)
 				goto done;
 		}
-- 
2.25.3




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

* Re: [PATCH] bcache: Trivial fix to bdput
  2020-12-21  3:17 [PATCH] bcache: Trivial fix to bdput Yi Li
  2020-12-21  5:48 ` [PATCH v2] bcache: Trivial fix to register_bcache Yi Li
@ 2020-12-21  7:35 ` Coly Li
  2020-12-21  9:49   ` [PATCH v4] bcache:remove a superfluous check in register_bcache Yi Li
  1 sibling, 1 reply; 5+ messages in thread
From: Coly Li @ 2020-12-21  7:35 UTC (permalink / raw)
  To: Yi Li; +Cc: yilikernel, kent.overstreet, linux-bcache, linux-kernel

On 12/21/20 11:17 AM, Yi Li wrote:
> Trivial fix to bdput.
> 
> Signed-off-by: Yi Li <yili@winhong.com>e

Hi Yi,

Indeed these two fixes are not that trivial. I suggest to describe more
detail about why your fixes are necessary and what problems are fixed by
your patches.


Thanks.

Coly Li


> ---
>  drivers/md/bcache/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index f7ad1e26b013..1756f6926098 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2525,8 +2525,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
>  			else
>  				err = "device busy";
>  			mutex_unlock(&bch_register_lock);
> -			if (!IS_ERR(bdev))
> -				bdput(bdev);
> +			if (!IS_ERR(dev))
> +				bdput(dev);
>  			if (attr == &ksysfs_register_quiet)
>  				goto done;
>  		}
> 


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

* [PATCH v4] bcache:remove a superfluous check in register_bcache
  2020-12-21  7:35 ` [PATCH] bcache: Trivial fix to bdput Coly Li
@ 2020-12-21  9:49   ` Yi Li
  2020-12-23  8:58     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Yi Li @ 2020-12-21  9:49 UTC (permalink / raw)
  To: colyli
  Cc: yilikernel, kent.overstreet, hch, linux-bcache, linux-kernel, Yi Li

There have no reassign the bdev after check It is IS_ERR.
the double check !IS_ERR(bdev) is superfluous.

After commit 4e7b5671c6a8 ("block: remove i_bdev"),
"Switch the block device lookup interfaces to directly work with a dev_t
so that struct block_device references are only acquired by the
blkdev_get variants (and the blk-cgroup special case).  This means that
we now don't need an extra reference in the inode and can generally
simplify handling of struct block_device to keep the lookups contained
in the core block layer code."

so after lookup_bdev call, there no need to do bdput.

remove a superfluous check the bdev & don't call bdput after lookup_bdev.

Fixes: 4e7b5671c6a8("block: remove i_bdev")
Signed-off-by: Yi Li <yili@winhong.com>
---
 drivers/md/bcache/super.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 0e06d721cd8e..a4752ac410dc 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2535,8 +2535,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 			else
 				err = "device busy";
 			mutex_unlock(&bch_register_lock);
-			if (!IS_ERR(bdev))
-				bdput(bdev);
 			if (attr == &ksysfs_register_quiet)
 				goto done;
 		}
-- 
2.25.3




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

* Re: [PATCH v4] bcache:remove a superfluous check in register_bcache
  2020-12-21  9:49   ` [PATCH v4] bcache:remove a superfluous check in register_bcache Yi Li
@ 2020-12-23  8:58     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-12-23  8:58 UTC (permalink / raw)
  To: Yi Li
  Cc: colyli, yilikernel, kent.overstreet, hch, linux-bcache, linux-kernel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

end of thread, other threads:[~2020-12-23  8:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  3:17 [PATCH] bcache: Trivial fix to bdput Yi Li
2020-12-21  5:48 ` [PATCH v2] bcache: Trivial fix to register_bcache Yi Li
2020-12-21  7:35 ` [PATCH] bcache: Trivial fix to bdput Coly Li
2020-12-21  9:49   ` [PATCH v4] bcache:remove a superfluous check in register_bcache Yi Li
2020-12-23  8:58     ` Christoph Hellwig

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).