Author: pfg
Date: Sun Feb 14 19:52:50 2016
New Revision: 295616
URL: https://svnweb.freebsd.org/changeset/base/295616

Log:
  ext2fs:       Remove panics for rename() race conditions.
  
  Sync with r84642 from UFS:
  
  The panics are inappropriate because the IN_RENAME flag only fixes a
  few of the huge number of race conditions that can result in the
  source path becoming invalid even prior to the VOP_RENAME() call.
  
  Found accidentally while checking an issue from PVS Static Analysis.
  
  MFC after:    3 days

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c     Sun Feb 14 18:57:40 2016        
(r295615)
+++ head/sys/fs/ext2fs/ext2_vnops.c     Sun Feb 14 19:52:50 2016        
(r295616)
@@ -985,10 +985,10 @@ abortit:
                dp = VTOI(fdvp);
        } else {
                /*
-                * From name has disappeared.
+                * From name has disappeared.  IN_RENAME is not sufficient
+                * to protect against directory races due to timing windows,
+                * so we can't panic here.
                 */
-               if (doingdirectory)
-                       panic("ext2_rename: lost dir entry");
                vrele(ap->a_fvp);
                return (0);
        }
@@ -1003,8 +1003,11 @@ abortit:
         * rename.
         */
        if (xp != ip) {
-               if (doingdirectory)
-                       panic("ext2_rename: lost dir entry");
+               /*
+                * From name resolves to a different inode.  IN_RENAME is
+                * not sufficient protection against timing window races
+                * so we can't panic here.
+                */
        } else {
                /*
                 * If the source is a directory with a
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to