Skip to content

Commit 3a52c03

Browse files
author
Al Viro
committed
pktcdvd: sort set_blocksize() calls out
1) it doesn't make any sense to have ->open() call set_blocksize() on the device being opened - the caller will override that anyway. 2) setting block size on underlying device, OTOH, ought to be done when we are opening it exclusive - i.e. as part of pkt_open_dev(). Having it done at setup time doesn't guarantee us anything about the state at the time we start talking to it. Worse, if you happen to have the underlying device containing e.g. ext2 with 4Kb blocks that is currently mounted r/o, that set_blocksize() will confuse the hell out of filesystem. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent af63dd7 commit 3a52c03

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/block/pktcdvd.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, bool write)
22152215
}
22162216
dev_info(ddev, "%lukB available on disc\n", lba << 1);
22172217
}
2218+
set_blocksize(file_bdev(bdev_file), CD_FRAMESIZE);
22182219

22192220
return 0;
22202221

@@ -2278,11 +2279,6 @@ static int pkt_open(struct gendisk *disk, blk_mode_t mode)
22782279
ret = pkt_open_dev(pd, mode & BLK_OPEN_WRITE);
22792280
if (ret)
22802281
goto out_dec;
2281-
/*
2282-
* needed here as well, since ext2 (among others) may change
2283-
* the blocksize at mount time
2284-
*/
2285-
set_blocksize(disk->part0, CD_FRAMESIZE);
22862282
}
22872283
mutex_unlock(&ctl_mutex);
22882284
mutex_unlock(&pktcdvd_mutex);
@@ -2526,7 +2522,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
25262522
__module_get(THIS_MODULE);
25272523

25282524
pd->bdev_file = bdev_file;
2529-
set_blocksize(file_bdev(bdev_file), CD_FRAMESIZE);
25302525

25312526
atomic_set(&pd->cdrw.pending_bios, 0);
25322527
pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->disk->disk_name);

0 commit comments

Comments
 (0)