Skip to content

Commit

Permalink
Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"
Browse files Browse the repository at this point in the history
This reverts commit ff06db1.
  • Loading branch information
Jens Axboe committed Aug 25, 2016
1 parent 5bb53c0 commit 468c298
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,11 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)

opened_bdev[drive] = bdev;

if (!(mode & (FMODE_READ|FMODE_WRITE))) {
res = -EINVAL;
goto out;
}

res = -ENXIO;

if (!floppy_track_buffer) {
Expand Down Expand Up @@ -3706,15 +3711,13 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
if (UFDCS->rawcmd == 1)
UFDCS->rawcmd = 2;

if (mode & (FMODE_READ|FMODE_WRITE)) {
UDRS->last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
check_disk_change(bdev);
if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
goto out;
}
UDRS->last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
check_disk_change(bdev);
if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
goto out;

res = -EROFS;

Expand Down

0 comments on commit 468c298

Please sign in to comment.