git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
To: GIT <git@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] 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]
Date: Sun, 22 May 2005 23:23:12 +0200	[thread overview]
Message-ID: <20050522212312.GC23388@cip.informatik.uni-erlangen.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0505221332590.2307@ppc970.osdl.org>

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.

> As to your update-cache problem, it seems to be just due to NFS stat
> caching. You generally should _not_ work on two machines at the same time,
> but it probably does the right thing in the end.

I added some debugging output (see attached patch) and saw that the
reason for the invalid thing is that the inode has changed:

...
name: pull.h 0x00000010
name: read-cache.c 0x00000010
...

#define INODE_CHANGED   0x0010

Same problem tla had. It looked at the device number. And of course the
device number for NFS shares isn't the same on all machines. So I
attached a little patch which fixes the issue for me (and others).

> In general, I would suggest using separate GIT repositories over sharing
> them over NFS. As far as I'm concerned, I think NFS should work in the
> sense that you can work from different clients at _different_times_, and
> I'm certainly not going to guarantee that two different clients that work
> at the same time against the same repository will get sane results.

It is more like that I don't remember on which machine I worked last and
working accidently on my next free window in screen (and I have a lot of
windows). And getting 370 Mbyte over NFS hits my nerves. ;-)

> For example, if you do a "git-checkout-cache -f -a" at the same time, I 
> won't guarantee that things won't race on the working files. Don't do it.

I will not do that. And I will add locking for such operations in my frontend
anyway.

	Thomas

CRAP CRAP CRAP: This is just the patch which showed me the debugging
output:

diff --git a/update-cache.c b/update-cache.c
--- a/update-cache.c
+++ b/update-cache.c
@@ -174,6 +174,8 @@ static struct cache_entry *refresh_entry
 	if (!changed)
 		return ce;
 
+	fprintf(stderr, "name: %s 0x%08x\n", ce->name, changed);
+
 	/*
 	 * If the mode or type has changed, there's no point in trying
 	 * to refresh the entry - it's not going to match

Here is the real patch:

[PATCH] Don't include devicenumber into INODE_CHANGED test

This fixes the problem that git-update-cache --refresh rebuilds the
cache stat information everytime it is started on a different host while
working in the same NFS shared repository.

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,7 @@ 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))
+	if (ce->ce_ino != htonl(st->st_ino))
 		changed |= INODE_CHANGED;
 	if (ce->ce_size != htonl(st->st_size))
 		changed |= DATA_CHANGED;

  reply	other threads:[~2005-05-22 21:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-22 12:28 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
2005-05-22 19:09 ` Linus Torvalds
2005-05-22 19:27   ` Thomas Glanzmann
2005-05-22 20:43     ` Linus Torvalds
2005-05-22 21:23       ` Thomas Glanzmann [this message]
2005-05-22 21:41         ` Alternate Patch: [PATCH] Don't include device number in cache invalidation when running on NFS Thomas Glanzmann
2005-05-22 21:58           ` Linus Torvalds
2005-05-22 22:07             ` Thomas Glanzmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050522212312.GC23388@cip.informatik.uni-erlangen.de \
    --to=sithglan@stud.uni-erlangen.de \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).