git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Alternate Patch: [PATCH] Don't include device number in cache invalidation when running on NFS

From
TGThomas Glanzmann <sithglan@stud.uni-erlangen.de>
Date
May 22, 2005, 21:41 UTC
Message-ID
<20050522214115.GD23388@cip.informatik.uni-erlangen.de>
In-Reply-To
<20050522212312.GC23388@cip.informatik.uni-erlangen.de>
Hello,
* Thomas Glanzmann <sithglan@stud.uni-erlangen.de> [050522 23:24]:
> Hello,
> > Sorry, I meant "rename", not "link", and yes, it should be NFS-safe. It's 
> > how all the mailers do things too, afaik.
> okay. I will doublecheck that and come back.
yes, you're right.
While reading liblockfile I saw the following:
/*
 *      See if the directory where is certain file is in
 *      is located on an NFS mounted volume.
 */
static int is_nfs(const char *file)
{
        char dir[1024];
        char *s;
        struct stat st;
        strncpy(dir, file, sizeof(dir));
        if ((s = strrchr(dir, '/')) != NULL)
                *s = 0;
        else
                strcpy(dir, ".");
        if (stat(dir, &st) < 0)
                return 0;
        return ((st.st_dev & 0xFF00) == 0);
}

So here comes an alternate patch if you like to verify the st_dev for non NFS stuff. Also tested.

[PATCH] Don't include device number in cache invalidation when running on NFS

This patches includes the device number only in the cache invalidation process when not running on a NFS volume.

Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
diff --git a/read-cache.c b/read-cache.c
--- a/read-cache.c
+++ b/read-cache.c
@@ -65,8 +65,11 @@ int ce_match_stat(struct cache_entry *ce
 	if (ce->ce_uid != htonl(st->st_uid) ||
 	    ce->ce_gid != htonl(st->st_gid))
 		changed |= OWNER_CHANGED;
-	if (ce->ce_dev != htonl(st->st_dev) ||
-	    ce->ce_ino != htonl(st->st_ino))
+	/* Only include device number if not running on NFS */
+	if (ce->ce_dev != htonl(st->st_dev) &&
+	    ((st->st_dev & 0xFF00) == 0))
+		changed |= INODE_CHANGED;
+	if (ce->ce_ino != htonl(st->st_ino))
 		changed |= INODE_CHANGED;
 	if (ce->ce_size != htonl(st->st_size))
 		changed |= DATA_CHANGED;
Previous: Thomas GlanzmannNext: Linus Torvalds
Message 6 of 8 in “running git-update-cache --refresh on different machines on a NFS share always ends up in a lot of io/cpu/time waste”
  1. Thomas GlanzmannMay 22, 2005
  2. Linus TorvaldsMay 22, 2005
  3. Thomas GlanzmannMay 22, 2005
  4. Linus TorvaldsMay 22, 2005
  5. Don't include devicenumber into INODE_CHANGED test [WAS: Re: running git-update-cache --refresh on different machines on a NFS share always ends up in a lot of io/cpu/time waste]Thomas Glanzmann, May 22, 2005
  6. Alternate Patch: [PATCH] Don't include device number in cache invalidation when running on NFSThomas Glanzmann, May 22, 2005
  7. Linus TorvaldsMay 22, 2005
  8. Thomas GlanzmannMay 22, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.