Problems with 2.6.10-rc2-bk12 and directory entries

From: Holger Kiehl (Holger.Kiehl_at_dwd.de)
Date: 11/30/04

  • Next message: SYMPA: "Results of your commands"
    Date:	Tue, 30 Nov 2004 09:30:09 +0000 (GMT)
    To: linux-kernel <linux-kernel@vger.kernel.org>
    
    

    Hello

    Using 2.6.10-rc2-bk12 on a dual Xeon which serves files at a high rate
    (>200 files/second), I noticed that when doing:

        ptr = dirname + strlen(dirname);
        dp = opendir(dirname);
        while ((dirp = readdir(dp)) != NULL)
        {
           if ((dirp->d_name[0] == '.') && ((dirp->d_name[1] == '\0') ||
               ((dirp->d_name[1] == '.') && (dirp->d_name[2] == '\0'))))
           {
              continue;
           }
           strcpy(ptr, dirp->d_name);
           if (unlink(dirname) == -1)
           {
              if (errno == ENOENT)
              {
                 print some error
              }
           }
        }

    That under higher load it happens that the unlink fails with ENOENT. And
    this is true because the file was unlinked by a previous call. So it seems
    that readdir() returns some file name that has already been removed.
    This is not the only place, I have other code pathes where this also happens,
    for example where I move the files away instead of unlinking.

    This did not happen with 2.6.7 or any kernels before that. Filesystem is
    ext3 without any extensions.

    Is this a known problem? What can I do to resolve this?

    Thanks,
    Holger

    PS: Please CC me since I am not on the list.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: SYMPA: "Results of your commands"

    Relevant Pages

    • Re: Oops w/sysfs when closing a disconnected usb serial device
      ... > parent kobject going away before child. ... but I don't see how that is happening in the usb code:( ... told the usb core to unlink a urb that was already unlinked. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: silent semantic changes with reiser4
      ... The real issue is what to do with unlink() et.al. ... a mountpoint in other life" - I'm happy and we can get a lot of much ... our life would be much easier if we stopped trying ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: -mm -> 2.6.13 merge status
      ... >> hopefully going to die is the last instance of it that isn't either ... > another node did the unlink. ... It fixes up i_nlink in that case, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] Add getdents32t syscall
      ... rm stats the file each time before trying to unlink it even ... we still stat the file, ... Andreas Dilger ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] coredump - as root not only if euid switched
      ... probably if you even care to write this.. ... It's very small, but heck, we unlink a lot more often than we dump core. ... > would fastcall do_unlinkhelp? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)