Skip to content

Commit b68ea0e

Browse files
committed
Merge tag 'for-linus-20180524' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "Two fixes that should go into this release: - a loop writeback error clearing fix from Jeff - the sr sense fix from myself" * tag 'for-linus-20180524' of git://git.kernel.dk/linux-block: loop: clear wb_err in bd_inode when detaching backing file sr: pass down correctly sized SCSI sense buffer
2 parents 9ca5a2a + eedffa2 commit b68ea0e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/block/loop.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ static int loop_clr_fd(struct loop_device *lo)
10681068
if (bdev) {
10691069
bdput(bdev);
10701070
invalidate_bdev(bdev);
1071+
bdev->bd_inode->i_mapping->wb_err = 0;
10711072
}
10721073
set_capacity(lo->lo_disk, 0);
10731074
loop_sysfs_exit(lo);

drivers/scsi/sr_ioctl.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,26 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
188188
struct scsi_device *SDev;
189189
struct scsi_sense_hdr sshdr;
190190
int result, err = 0, retries = 0;
191+
unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE], *senseptr = NULL;
191192

192193
SDev = cd->device;
193194

195+
if (cgc->sense)
196+
senseptr = sense_buffer;
197+
194198
retry:
195199
if (!scsi_block_when_processing_errors(SDev)) {
196200
err = -ENODEV;
197201
goto out;
198202
}
199203

200204
result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
201-
cgc->buffer, cgc->buflen,
202-
(unsigned char *)cgc->sense, &sshdr,
205+
cgc->buffer, cgc->buflen, senseptr, &sshdr,
203206
cgc->timeout, IOCTL_RETRIES, 0, 0, NULL);
204207

208+
if (cgc->sense)
209+
memcpy(cgc->sense, sense_buffer, sizeof(*cgc->sense));
210+
205211
/* Minimal error checking. Ignore cases we know about, and report the rest. */
206212
if (driver_byte(result) != 0) {
207213
switch (sshdr.sense_key) {

0 commit comments

Comments
 (0)