All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op
@ 2022-05-06 15:22 Xiubo Li
  2022-05-06 15:44 ` Jeff Layton
  2022-05-10  7:58 ` Ilya Dryomov
  0 siblings, 2 replies; 4+ messages in thread
From: Xiubo Li @ 2022-05-06 15:22 UTC (permalink / raw)
  To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li

Use the VM_BUG_ON_FOLIO macro to get more infomation when we hit
the BUG_ON, and continue the loop when seeing the incorrect none
write opcode in writepages_finish().

URL: https://tracker.ceph.com/issues/55421
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/addr.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 04a6c3f02f0c..63b7430e1ce6 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
 	if (folio_test_dirty(folio)) {
 		dout("%p dirty_folio %p idx %lu -- already dirty\n",
 		     mapping->host, folio, folio->index);
-		BUG_ON(!folio_get_private(folio));
+		VM_BUG_ON_FOLIO(!folio_get_private(folio), folio);
 		return false;
 	}
 
@@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
 	 * Reference snap context in folio->private.  Also set
 	 * PagePrivate so that we get invalidate_folio callback.
 	 */
-	BUG_ON(folio_get_private(folio));
+	VM_BUG_ON_FOLIO(folio_get_private(folio), folio);
 	folio_attach_private(folio, snapc);
 
 	return ceph_fscache_dirty_folio(mapping, folio);
@@ -733,8 +733,11 @@ static void writepages_finish(struct ceph_osd_request *req)
 
 	/* clean all pages */
 	for (i = 0; i < req->r_num_ops; i++) {
-		if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
+		if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) {
+			pr_warn("%s incorrect op %d req %p index %d tid %llu\n",
+				__func__, req->r_ops[i].op, req, i, req->r_tid);
 			break;
+		}
 
 		osd_data = osd_req_op_extent_osd_data(req, i);
 		BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
-- 
2.36.0.rc1


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

* Re: [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op
  2022-05-06 15:22 [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op Xiubo Li
@ 2022-05-06 15:44 ` Jeff Layton
  2022-05-10  7:58 ` Ilya Dryomov
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2022-05-06 15:44 UTC (permalink / raw)
  To: Xiubo Li; +Cc: idryomov, vshankar, ceph-devel

On Fri, 2022-05-06 at 23:22 +0800, Xiubo Li wrote:
> Use the VM_BUG_ON_FOLIO macro to get more infomation when we hit
> the BUG_ON, and continue the loop when seeing the incorrect none
> write opcode in writepages_finish().
> 
> URL: https://tracker.ceph.com/issues/55421
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 04a6c3f02f0c..63b7430e1ce6 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>  	if (folio_test_dirty(folio)) {
>  		dout("%p dirty_folio %p idx %lu -- already dirty\n",
>  		     mapping->host, folio, folio->index);
> -		BUG_ON(!folio_get_private(folio));
> +		VM_BUG_ON_FOLIO(!folio_get_private(folio), folio);
>  		return false;
>  	}
>  
> @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>  	 * Reference snap context in folio->private.  Also set
>  	 * PagePrivate so that we get invalidate_folio callback.
>  	 */
> -	BUG_ON(folio_get_private(folio));
> +	VM_BUG_ON_FOLIO(folio_get_private(folio), folio);
>  	folio_attach_private(folio, snapc);
>  
>  	return ceph_fscache_dirty_folio(mapping, folio);
> @@ -733,8 +733,11 @@ static void writepages_finish(struct ceph_osd_request *req)
>  
>  	/* clean all pages */
>  	for (i = 0; i < req->r_num_ops; i++) {
> -		if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
> +		if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) {
> +			pr_warn("%s incorrect op %d req %p index %d tid %llu\n",
> +				__func__, req->r_ops[i].op, req, i, req->r_tid);
>  			break;
> +		}
>  
>  		osd_data = osd_req_op_extent_osd_data(req, i);
>  		BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);

Reviewed-by: Jeff Layton <jlayton@kernel.org>

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

* Re: [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op
  2022-05-06 15:22 [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op Xiubo Li
  2022-05-06 15:44 ` Jeff Layton
@ 2022-05-10  7:58 ` Ilya Dryomov
  2022-05-10  8:00   ` Xiubo Li
  1 sibling, 1 reply; 4+ messages in thread
From: Ilya Dryomov @ 2022-05-10  7:58 UTC (permalink / raw)
  To: Xiubo Li; +Cc: Jeff Layton, Venky Shankar, Ceph Development

On Fri, May 6, 2022 at 5:22 PM Xiubo Li <xiubli@redhat.com> wrote:
>
> Use the VM_BUG_ON_FOLIO macro to get more infomation when we hit
> the BUG_ON, and continue the loop when seeing the incorrect none
> write opcode in writepages_finish().
>
> URL: https://tracker.ceph.com/issues/55421
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 04a6c3f02f0c..63b7430e1ce6 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>         if (folio_test_dirty(folio)) {
>                 dout("%p dirty_folio %p idx %lu -- already dirty\n",
>                      mapping->host, folio, folio->index);
> -               BUG_ON(!folio_get_private(folio));
> +               VM_BUG_ON_FOLIO(!folio_get_private(folio), folio);
>                 return false;
>         }
>
> @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>          * Reference snap context in folio->private.  Also set
>          * PagePrivate so that we get invalidate_folio callback.
>          */
> -       BUG_ON(folio_get_private(folio));
> +       VM_BUG_ON_FOLIO(folio_get_private(folio), folio);
>         folio_attach_private(folio, snapc);
>
>         return ceph_fscache_dirty_folio(mapping, folio);
> @@ -733,8 +733,11 @@ static void writepages_finish(struct ceph_osd_request *req)
>
>         /* clean all pages */
>         for (i = 0; i < req->r_num_ops; i++) {
> -               if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
> +               if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) {
> +                       pr_warn("%s incorrect op %d req %p index %d tid %llu\n",
> +                               __func__, req->r_ops[i].op, req, i, req->r_tid);
>                         break;
> +               }
>
>                 osd_data = osd_req_op_extent_osd_data(req, i);
>                 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
> --
> 2.36.0.rc1
>

Hi Xiubo,

Since in this revision the loop isn't actually continued, the only
substantive change left seems to be the addition of pr_warn before the
break.  I went ahead and folded this patch into "ceph: check folio
PG_private bit instead of folio->private" (which is now queued up for
5.18-rc).

Thanks,

                Ilya

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

* Re: [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op
  2022-05-10  7:58 ` Ilya Dryomov
@ 2022-05-10  8:00   ` Xiubo Li
  0 siblings, 0 replies; 4+ messages in thread
From: Xiubo Li @ 2022-05-10  8:00 UTC (permalink / raw)
  To: Ilya Dryomov; +Cc: Jeff Layton, Venky Shankar, Ceph Development


On 5/10/22 3:58 PM, Ilya Dryomov wrote:
> On Fri, May 6, 2022 at 5:22 PM Xiubo Li <xiubli@redhat.com> wrote:
>> Use the VM_BUG_ON_FOLIO macro to get more infomation when we hit
>> the BUG_ON, and continue the loop when seeing the incorrect none
>> write opcode in writepages_finish().
>>
>> URL: https://tracker.ceph.com/issues/55421
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/addr.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
>> index 04a6c3f02f0c..63b7430e1ce6 100644
>> --- a/fs/ceph/addr.c
>> +++ b/fs/ceph/addr.c
>> @@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>>          if (folio_test_dirty(folio)) {
>>                  dout("%p dirty_folio %p idx %lu -- already dirty\n",
>>                       mapping->host, folio, folio->index);
>> -               BUG_ON(!folio_get_private(folio));
>> +               VM_BUG_ON_FOLIO(!folio_get_private(folio), folio);
>>                  return false;
>>          }
>>
>> @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>>           * Reference snap context in folio->private.  Also set
>>           * PagePrivate so that we get invalidate_folio callback.
>>           */
>> -       BUG_ON(folio_get_private(folio));
>> +       VM_BUG_ON_FOLIO(folio_get_private(folio), folio);
>>          folio_attach_private(folio, snapc);
>>
>>          return ceph_fscache_dirty_folio(mapping, folio);
>> @@ -733,8 +733,11 @@ static void writepages_finish(struct ceph_osd_request *req)
>>
>>          /* clean all pages */
>>          for (i = 0; i < req->r_num_ops; i++) {
>> -               if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
>> +               if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) {
>> +                       pr_warn("%s incorrect op %d req %p index %d tid %llu\n",
>> +                               __func__, req->r_ops[i].op, req, i, req->r_tid);
>>                          break;
>> +               }
>>
>>                  osd_data = osd_req_op_extent_osd_data(req, i);
>>                  BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
>> --
>> 2.36.0.rc1
>>
> Hi Xiubo,
>
> Since in this revision the loop isn't actually continued, the only
> substantive change left seems to be the addition of pr_warn before the
> break.  I went ahead and folded this patch into "ceph: check folio
> PG_private bit instead of folio->private" (which is now queued up for
> 5.18-rc).

Sure, Ilya.

Thanks!

-- Xiubo

>
> Thanks,
>
>                  Ilya
>


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

end of thread, other threads:[~2022-05-10  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 15:22 [PATCH v3] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op Xiubo Li
2022-05-06 15:44 ` Jeff Layton
2022-05-10  7:58 ` Ilya Dryomov
2022-05-10  8:00   ` Xiubo Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.