patch-2.4.26 linux-2.4.26/fs/locks.c

Next file: linux-2.4.26/fs/nfs/dir.c
Previous file: linux-2.4.26/fs/lockd/xdr4.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.25/fs/locks.c linux-2.4.26/fs/locks.c
@@ -1740,7 +1740,14 @@
 	before = &inode->i_flock;
 	while ((fl = *before) != NULL) {
 		if ((fl->fl_flags & FL_POSIX) && fl->fl_owner == owner) {
+			struct file *filp = fl->fl_file;
+			/* Note: locks_unlock_delete() can sleep, and
+			 * so we may race with the call to sys_close()
+			 * by the thread that actually owns this filp.
+			 */
+			get_file(filp);
 			locks_unlock_delete(before);
+			fput(filp);
 			before = &inode->i_flock;
 			continue;
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)