diff mbox series

[12/13] floppy: end whole request on error

Message ID 4b575ac74fab6d233b891f8c12dadaea3873931c.1539282366.git.osandov@fb.com (mailing list archive)
State New, archived
Headers show
Series [01/13] swim: fix cleanup on setup error | expand

Commit Message

Omar Sandoval Oct. 11, 2018, 6:30 p.m. UTC
From: Omar Sandoval <osandov@fb.com>

If floppy_end_request() gets passed an error, it should end the whole
request, not just the current segment.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 drivers/block/floppy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Jens Axboe Oct. 11, 2018, 6:39 p.m. UTC | #1
On 10/11/18 12:30 PM, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> If floppy_end_request() gets passed an error, it should end the whole
> request, not just the current segment.

I don't think this is correct, we should still just end the
individual chunks.
Omar Sandoval Oct. 11, 2018, 6:57 p.m. UTC | #2
On Thu, Oct 11, 2018 at 12:39:51PM -0600, Jens Axboe wrote:
> On 10/11/18 12:30 PM, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > If floppy_end_request() gets passed an error, it should end the whole
> > request, not just the current segment.
> 
> I don't think this is correct, we should still just end the
> individual chunks.

Yup, I'll drop this and the swim3 equivalent, thanks.
diff mbox series

Patch

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index f2b6f4da1034..acbafd831ea3 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2210,13 +2210,15 @@  static int do_format(int drive, struct format_descr *tmp_format_req)
 
 static void floppy_end_request(struct request *req, blk_status_t error)
 {
-	unsigned int nr_sectors = current_count_sectors;
+	unsigned int nr_bytes;
 	unsigned int drive = (unsigned long)req->rq_disk->private_data;
 
 	/* current_count_sectors can be zero if transfer failed */
 	if (error)
-		nr_sectors = blk_rq_cur_sectors(req);
-	if (__blk_end_request(req, error, nr_sectors << 9))
+		nr_bytes = blk_rq_bytes(req);
+	else
+		nr_bytes = current_count_sectors << 9;
+	if (__blk_end_request(req, error, nr_bytes))
 		return;
 
 	/* We're done with the request */