patch-2.1.57 linux/drivers/block/swim3.c

Next file: linux/drivers/cdrom/cdu31a.c
Previous file: linux/drivers/block/floppy.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.56/linux/drivers/block/swim3.c linux/drivers/block/swim3.c
@@ -683,8 +683,7 @@
 	if (fs->state != idle) {
 		++fs->wanted;
 		while (fs->state != available) {
-			if (interruptible
-			    && (current->signal & ~current->blocked)) {
+			if (interruptible && signal_pending(current)) {
 				--fs->wanted;
 				restore_flags(flags);
 				return -EINTR;
@@ -720,7 +719,7 @@
 	for (n = 2*HZ; n > 0; --n) {
 		if (swim3_readbit(fs, RELAX))
 			break;
-		if ((current->signal & ~current->blocked) != 0) {
+		if (signal_pending(current)) {
 			err = -EINTR;
 			break;
 		}
@@ -781,7 +780,7 @@
 		for (n = HZ; n > 0; --n) {
 			if (swim3_readbit(fs, SEEK_COMPLETE))
 				break;
-			if ((current->signal & ~current->blocked) != 0) {
+			if (signal_pending(current)) {
 				err = -EINTR;
 				break;
 			}
@@ -840,9 +839,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);
@@ -880,7 +886,7 @@
 	for (n = HZ; n > 0; --n) {
 		if (swim3_readbit(fs, SEEK_COMPLETE))
 			break;
-		if ((current->signal & ~current->blocked) != 0)
+		if (signal_pending(current))
 			break;
 		current->state = TASK_INTERRUPTIBLE;
 		current->timeout = jiffies + 1;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov