Commit f2791e7e authored by Jens Axboe's avatar Jens Axboe

Revert "floppy: refactor open() flags handling"

This reverts commit 09954bad.
parent 468c298a
...@@ -3663,11 +3663,6 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) ...@@ -3663,11 +3663,6 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
opened_bdev[drive] = bdev; opened_bdev[drive] = bdev;
if (!(mode & (FMODE_READ|FMODE_WRITE))) {
res = -EINVAL;
goto out;
}
res = -ENXIO; res = -ENXIO;
if (!floppy_track_buffer) { if (!floppy_track_buffer) {
...@@ -3711,20 +3706,21 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) ...@@ -3711,20 +3706,21 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
if (UFDCS->rawcmd == 1) if (UFDCS->rawcmd == 1)
UFDCS->rawcmd = 2; UFDCS->rawcmd = 2;
UDRS->last_checked = 0; if (!(mode & FMODE_NDELAY)) {
clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); if (mode & (FMODE_READ|FMODE_WRITE)) {
check_disk_change(bdev); UDRS->last_checked = 0;
if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags)) clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
goto out; check_disk_change(bdev);
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
goto out; goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
res = -EROFS; goto out;
}
if ((mode & FMODE_WRITE) && res = -EROFS;
!test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) if ((mode & FMODE_WRITE) &&
goto out; !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
goto out;
}
mutex_unlock(&open_lock); mutex_unlock(&open_lock);
mutex_unlock(&floppy_mutex); mutex_unlock(&floppy_mutex);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment