From: Christoph Hellwig <hch@infradead.org>
To: Jakob Oestergaard <jakob@unthought.net>,
Jan Kasprzak <kas@fi.muni.cz>,
linux-kernel@vger.kernel.org, kruty@fi.muni.cz
Subject: Re: XFS: inode with st_mode == 0
Date: Thu, 9 Dec 2004 21:54:14 +0000 [thread overview]
Message-ID: <20041209215414.GA21503@infradead.org> (raw)
In-Reply-To: <20041209135322.GK347@unthought.net>
[sorry, last post got out to far too few people]
On Thu, Dec 09, 2004 at 02:53:23PM +0100, Jakob Oestergaard wrote:
> On Thu, Dec 09, 2004 at 01:59:18PM +0100, Jan Kasprzak wrote:
> > Hi all,
> >
> > I have seen the strange problem on our NFS server: yesterday I have
> > found an empty file owned by UID 0/GID 0 and st_mode == 0 in my home
> > directory (ls -l said "?--------- 1 root root 0 <date> <filename>").
> > The <filename> was correct name of a temporary file used by one of my
> > cron jobs (and the cron job was failing because it could not rewrite the file).
> > It was not possible to write to this file, so I have renamed it
> > as "badfile" for further investigation (using mv(1) on the NFS server itself).
>
> Known problem
>
> http://lkml.org/lkml/2004/11/23/283
>
> Seems there is no solution yet
>
> http://lkml.org/lkml/2004/11/30/145
If it's really st_mode I suspect it's a different problem. Can you retry
with current oss.sgi.com CVS (or the patch below). Note that this patch
breaks xfsdump unfortunately, we're looking into a fix.
> > Maybe some data is flushed in an incorrect order?
>
> Maybe :)
No, the problem I've fixed was related to XFS getting the inode version
number wrong - or at least different than NFSD expects.
Index: fs/xfs/xfs_ialloc.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/xfs_ialloc.c,v
retrieving revision 1.175
diff -u -p -r1.175 xfs_ialloc.c
--- fs/xfs/xfs_ialloc.c 6 Oct 2003 18:11:55 -0000 1.175
+++ fs/xfs/xfs_ialloc.c 30 Nov 2004 10:18:16 -0000
@@ -270,6 +270,11 @@ xfs_ialloc_ag_alloc(
INT_SET(dic.di_magic, ARCH_CONVERT, XFS_DINODE_MAGIC);
INT_SET(dic.di_version, ARCH_CONVERT, version);
+ /*
+ * Start at generation 1 because the NFS code uses 0 as wildcard.
+ */
+ INT_SET(dic.di_gen, ARCH_CONVERT, 1);
+
for (j = 0; j < nbufs; j++) {
/*
* Get the block.
Index: fs/xfs/xfs_inode.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/xfs_inode.c,v
retrieving revision 1.406
diff -u -p -r1.406 xfs_inode.c
--- fs/xfs/xfs_inode.c 27 Oct 2004 12:06:24 -0000 1.406
+++ fs/xfs/xfs_inode.c 30 Nov 2004 10:18:18 -0000
@@ -1028,6 +1028,16 @@ xfs_iread(
ip->i_d.di_projid = 0;
}
+ /*
+ * IRIX and older Linux Kernel initialized di_gen to zero when
+ * creating new inodes, but the NFSD uses i_generation = 0 as
+ * a wildcard. We bump di_gen here to avoid that problem for new
+ * exports, and filehandles created by an older kernel using
+ * the same filesystem are still valid as the wildcard matches it.
+ */
+ if (unlikely(ip->i_d.di_gen == 0))
+ ip->i_d.di_gen++;
+
ip->i_delayed_blks = 0;
/*
@@ -2370,11 +2380,17 @@ xfs_ifree(
XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
+
/*
* Bump the generation count so no one will be confused
- * by reincarnations of this inode.
+ * by reincarnations of this inode. Note that we have to
+ * skip 0 as that would confuse the NFS server, and we
+ * have to do it here because the XFS inode might be
+ * around for a while after deletion (unlike the normal
+ * Linux inode semantics).
*/
- ip->i_d.di_gen++;
+ if (++ip->i_d.di_gen == 0)
+ ip->i_d.di_gen++;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
if (delete) {
next prev parent reply other threads:[~2004-12-09 21:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 12:59 XFS: inode with st_mode == 0 Jan Kasprzak
2004-12-09 13:53 ` Jakob Oestergaard
2004-12-09 14:07 ` Jan Kasprzak
2004-12-09 21:54 ` Christoph Hellwig [this message]
2004-12-14 23:40 ` Jakob Oestergaard
2004-12-21 18:43 ` Jan Kasprzak
2004-12-22 8:41 ` Jakob Oestergaard
2004-12-22 18:23 ` Christoph Hellwig
2004-12-23 15:01 ` Jakob Oestergaard
2005-01-04 8:48 ` Jakob Oestergaard
2005-01-05 11:34 ` Christoph Hellwig
2005-01-14 18:14 ` David Greaves
2005-01-14 18:23 ` Jakob Oestergaard
2005-01-15 2:09 ` Nathan Scott
2005-01-17 0:53 ` Jakob Oestergaard
2005-01-16 13:51 ` Christoph Hellwig
2005-01-17 10:07 ` Jakob Oestergaard
2005-01-17 11:55 ` Jan-Frode Myklebust
2005-01-17 13:48 ` Anders Saaby
2005-01-17 21:31 ` journaled filesystems -- known instability; Was: " Jeffrey Hundstad
2005-01-17 20:54 ` Alan Cox
2005-01-20 22:30 ` Jeffrey E. Hundstad
2005-01-25 12:47 ` Stephen C. Tweedie
2005-01-25 15:09 ` Jeffrey Hundstad
2005-01-25 15:37 ` Stephen C. Tweedie
2005-01-28 20:15 ` Jeffrey E. Hundstad
2005-01-28 21:00 ` Stephen C. Tweedie
2005-01-28 21:06 ` Jeffrey E. Hundstad
2005-01-18 11:45 ` Jan Kasprzak
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=20041209215414.GA21503@infradead.org \
--to=hch@infradead.org \
--cc=jakob@unthought.net \
--cc=kas@fi.muni.cz \
--cc=kruty@fi.muni.cz \
--cc=linux-kernel@vger.kernel.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