From: "Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
Subject: [PATCH v1 2/2] block: loop: restore state on loop_configure() error
Date: Mon, 31 Aug 2026 12:20:44 -0300 [thread overview]
Message-ID: <20260831152044.166353-3-ivanrwcm25@gmail.com> (raw)
In-Reply-To: <20260831152044.166353-1-ivanrwcm25@gmail.com>
On failure after loop_assign_backing_file(), restore the backing
file GFP mask, clear lo_backing_file/lo_device, and re-enable uevents
before unlocking and dropping the file reference.
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
---
drivers/block/loop.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6f12976035b0..838554bd980e 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1123,6 +1123,13 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
return 0;
out_unlock:
+ if (lo->lo_backing_file) {
+ mapping_set_gfp_mask(lo->lo_backing_file->f_mapping,
+ lo->old_gfp_mask);
+ lo->lo_backing_file = NULL;
+ lo->lo_device = NULL;
+ }
+ dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
loop_global_unlock(lo, is_loop);
out_bdev:
if (!(mode & BLK_OPEN_EXCL))
--
2.43.0
next prev parent reply other threads:[~2026-08-31 15:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 15:20 [PATCH v1 0/2] block: brd/loop error-path cleanup Iván Ezequiel Rodriguez
2026-08-31 15:20 ` [PATCH v1 1/2] block: brd: destroy xa on allocation failure Iván Ezequiel Rodriguez
2026-08-31 15:20 ` Iván Ezequiel Rodriguez [this message]
2026-09-01 6:59 ` [syzbot ci] Re: block: brd/loop error-path cleanup syzbot ci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831152044.166353-3-ivanrwcm25@gmail.com \
--to=ivanrwcm25@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®