/[packages]/cauldron/kernel/current/PATCHES/patches/0006-ataflop-fix-error-handling-during-setup.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0006-ataflop-fix-error-handling-during-setup.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 11 months ago) by tmb
File size: 2186 byte(s)
add fixes from sashas autosel queue
1 From e33816fc8e292b223ef42d81c78afb8efd53b1cd Mon Sep 17 00:00:00 2001
2 From: Omar Sandoval <osandov@fb.com>
3 Date: Thu, 11 Oct 2018 12:20:49 -0700
4 Subject: [PATCH 006/145] ataflop: fix error handling during setup
5
6 [ Upstream commit 71327f547ee3a46ec5c39fdbbd268401b2578d0e ]
7
8 Move queue allocation next to disk allocation to fix a couple of issues:
9
10 - If add_disk() hasn't been called, we should clear disk->queue before
11 calling put_disk().
12 - If we fail to allocate a request queue, we still need to put all of
13 the disks, not just the ones that we allocated queues for.
14
15 Signed-off-by: Omar Sandoval <osandov@fb.com>
16 Signed-off-by: Jens Axboe <axboe@kernel.dk>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 drivers/block/ataflop.c | 25 +++++++++++++++----------
20 1 file changed, 15 insertions(+), 10 deletions(-)
21
22 diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
23 index dfb2c2622e5a..822e3060d834 100644
24 --- a/drivers/block/ataflop.c
25 +++ b/drivers/block/ataflop.c
26 @@ -1935,6 +1935,11 @@ static int __init atari_floppy_init (void)
27 unit[i].disk = alloc_disk(1);
28 if (!unit[i].disk)
29 goto Enomem;
30 +
31 + unit[i].disk->queue = blk_init_queue(do_fd_request,
32 + &ataflop_lock);
33 + if (!unit[i].disk->queue)
34 + goto Enomem;
35 }
36
37 if (UseTrackbuffer < 0)
38 @@ -1966,10 +1971,6 @@ static int __init atari_floppy_init (void)
39 sprintf(unit[i].disk->disk_name, "fd%d", i);
40 unit[i].disk->fops = &floppy_fops;
41 unit[i].disk->private_data = &unit[i];
42 - unit[i].disk->queue = blk_init_queue(do_fd_request,
43 - &ataflop_lock);
44 - if (!unit[i].disk->queue)
45 - goto Enomem;
46 set_capacity(unit[i].disk, MAX_DISK_SIZE * 2);
47 add_disk(unit[i].disk);
48 }
49 @@ -1984,13 +1985,17 @@ static int __init atari_floppy_init (void)
50
51 return 0;
52 Enomem:
53 - while (i--) {
54 - struct request_queue *q = unit[i].disk->queue;
55 + do {
56 + struct gendisk *disk = unit[i].disk;
57
58 - put_disk(unit[i].disk);
59 - if (q)
60 - blk_cleanup_queue(q);
61 - }
62 + if (disk) {
63 + if (disk->queue) {
64 + blk_cleanup_queue(disk->queue);
65 + disk->queue = NULL;
66 + }
67 + put_disk(unit[i].disk);
68 + }
69 + } while (i--);
70
71 unregister_blkdev(FLOPPY_MAJOR, "fd");
72 return -ENOMEM;
73 --
74 2.19.1
75

  ViewVC Help
Powered by ViewVC 1.1.30