Re: floppy oops in 2.1.56 - "if (!filp) use filp->d_entry"

Bill Hawes (whawes@star.net)
Tue, 23 Sep 1997 08:28:27 -0400


This is a multi-part message in MIME format.
--------------9776D1964A3F89887AAD0895
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

David Woodhouse wrote:
>
> Upon unmounting. I thought this had been reported before, but it was only done
> in 2.1.56, so it must have been a different one.

Hi David,
I posted a patch for the floppy oops several days ago, and have appended
a copy in case you missed it.

Regards,
Bill
--------------9776D1964A3F89887AAD0895
Content-Type: text/plain; charset=us-ascii; name="floppy_56-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="floppy_56-patch"

--- linux-2.1.56/drivers/block/floppy.c.old Sat Sep 20 08:16:10 1997
+++ linux-2.1.56/drivers/block/floppy.c Sun Sep 21 09:44:03 1997
@@ -3500,9 +3500,13 @@

drive = DRIVE(inode->i_rdev);

- if (!filp || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
- /* if the file is mounted OR (writable now AND writable at
- * open time) Linus: Does this cover all cases? */
+ /*
+ * If filp is NULL, we're being called from blkdev_release
+ * or after a failed mount attempt. In the former case the
+ * device has already been sync'ed, and in the latter no
+ * sync is required. Otherwise, sync if filp is writable.
+ */
+ if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
block_fsync(filp, filp->f_dentry);

if (UDRS->fd_ref < 0)
--- linux-2.1.56/drivers/block/ataflop.c.old Sat Sep 20 08:16:10 1997
+++ linux-2.1.56/drivers/block/ataflop.c Sun Sep 21 09:41:11 1997
@@ -1978,10 +1978,14 @@

drive = inode->i_rdev & 3;

- if (!filp || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
- /* if the file is mounted OR (writable now AND writable at open
- time) Linus: Does this cover all cases? */
- block_fsync (filp, filp->f_dentry);
+ /*
+ * If filp is NULL, we're being called from blkdev_release
+ * or after a failed mount attempt. In the former case the
+ * device has already been sync'ed, and in the latter no
+ * sync is required. Otherwise, sync if filp is writable.
+ */
+ if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
+ block_fsync (filp, filp->f_dentry);

if (fd_ref[drive] < 0)
fd_ref[drive] = 0;
--- linux-2.1.56/drivers/block/swim3.c.old Sat Sep 20 08:16:11 1997
+++ linux-2.1.56/drivers/block/swim3.c Sun Sep 21 09:47:28 1997
@@ -840,9 +840,16 @@

if (MINOR(inode->i_rdev) != 0)
return -ENXIO;
+ /*
+ * If filp is NULL, we're being called from blkdev_release
+ * or after a failed mount attempt. In the former case the
+ * device has already been sync'ed, and in the latter no
+ * sync is required. Otherwise, sync if filp is writable.
+ */
+ if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
+ block_fsync (filp, filp->f_dentry);
+
fs = &floppy_states[0];
- if (filp == 0 || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
- block_fsync(filp, filp->f_dentry);
sw = fs->swim3;
if (fs->ref_count > 0 && --fs->ref_count == 0) {
swim3_action(fs, MOTOR_OFF);

--------------9776D1964A3F89887AAD0895--