* Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
@ 2008-01-14 12:24 ` Gopala Krishna
2008-01-14 12:25 ` Gopala Krishna
2008-01-14 14:06 ` Andi Kleen
` (4 subsequent siblings)
5 siblings, 1 reply; 22+ messages in thread
From: Gopala Krishna @ 2008-01-14 12:24 UTC (permalink / raw)
To: xfs
Hi,
My system information:
-bash-3.00# uname -a
Linux XXXXX #1 SMP Thu May 17 14:00:09 UTC 2007 ia64 ia64 ia64
GNU/Linux
-bash-3.00# cat /etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP1 (ia64) - Kernel \r (\l).
Thanks,
Gopal.
On 1/14/08, Gopala Krishna <gopalakrishna.n.m@gmail.com> wrote:
>
> Hi,
> I am seeing some strange problem with XFS and would like to know the
> expected behavior and if it is faulty is there any patches to resolve the
> problem.
>
> Problem:
> ======
> Basically I am extracting metadata information for a given file by reading
> the inode structure from the particular disk offset (based on it's position
> calculated by published inode structure and super block structure
> information). Before reading the metada data information from the disk, I
> am calling fsync (I used to call sync, but later I changed to fsync, since
> sync is not guranteed to flush all meta data) to ensure all metadata
> related to file is flushed to disk. Later I am reading particular disk
> offset as per calculation. I am getting XFS magic field properly after
> mapping to XFs inode structure. However I am not getting dimode properly in
> some cases (not all cases) and it shows 00000 even for regular file and
> directory.
>
> It is happening only when I copy new file to XFS. But, when I unmount the
> file system and remount it, everything goes fine and I could get all
> expected meta data information and proper value for dimode (in the inode
> structure which indicates the type of the file, i.e regular directory
> etc.) .
>
> Once I mount it back and later even if I remove the same file and copy it
> back to XFS and then run my utility program, I could read mode information
> properly. But If I copy different file, again I could not get dimode
> properly. I have to unmount and remount to get the mode properly to make my
> utility program to display information properly. Once it starts getting
> proper mode value, it continues.
>
> So I am suspecting, even after calling fsync (which says it would block
> untill it flushes metadata information to disk ), is not really flushing. So
> only during unmount, it flushes metadata and hence I could get dimode
> properly. since after remounting , by reading metadata information , I could
> get mode properly and differentiate directory or regular file, and also it
> is filling magic etc. properly, I feel the data I am reading is right and
> that I could compare with stat system call and ls commands.
>
> If I am doing something wrong and no problem with XFS, then I should not
> get mode field properly even after unmount/remount operation.
>
> Is there any problem with XFS fsync? Why dimode is getting updated only
> during unmount? why not when I call fsync? Because fsync says it has to
> flush all meta dat to disk before existing.
>
> Please let me know your feedback.
>
[[HTML alternate version deleted]]
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Question related to XFS sync , especially fsync
2008-01-14 12:24 ` Gopala Krishna
@ 2008-01-14 12:25 ` Gopala Krishna
0 siblings, 0 replies; 22+ messages in thread
From: Gopala Krishna @ 2008-01-14 12:25 UTC (permalink / raw)
To: xfs
One more information:
XFS is not a root file system , but EXT3 is a root file system.
Thanks,
Gopal.
On 1/14/08, Gopala Krishna <gopalakrishna.n.m@gmail.com> wrote:
>
> Hi,
> My system information:
> -bash-3.00# uname -a
> Linux XXXXX #1 SMP Thu May 17 14:00:09 UTC 2007 ia64 ia64 ia64
> GNU/Linux
>
> -bash-3.00# cat /etc/issue
> Welcome to SUSE Linux Enterprise Server 10 SP1 (ia64) - Kernel \r (\l).
>
> Thanks,
> Gopal.
>
> On 1/14/08, Gopala Krishna <gopalakrishna.n.m@gmail.com> wrote:
> >
> > Hi,
> > I am seeing some strange problem with XFS and would like to know the
> > expected behavior and if it is faulty is there any patches to resolve the
> > problem.
> >
> > Problem:
> > ======
> > Basically I am extracting metadata information for a given file by
> > reading the inode structure from the particular disk offset (based on
> > it's position calculated by published inode structure and super block
> > structure information). Before reading the metada data information from the
> > disk, I am calling fsync (I used to call sync, but later I changed to fsync,
> > since sync is not guranteed to flush all meta data) to ensure all metadata
> > related to file is flushed to disk. Later I am reading particular disk
> > offset as per calculation. I am getting XFS magic field properly after
> > mapping to XFs inode structure. However I am not getting dimode properly in
> > some cases (not all cases) and it shows 00000 even for regular file and
> > directory.
> >
> > It is happening only when I copy new file to XFS. But, when I unmount
> > the file system and remount it, everything goes fine and I could get all
> > expected meta data information and proper value for dimode (in the inode
> > structure which indicates the type of the file, i.e regular directory
> > etc.) .
> >
> > Once I mount it back and later even if I remove the same file and copy
> > it back to XFS and then run my utility program, I could read mode
> > information properly. But If I copy different file, again I could not get
> > dimode properly. I have to unmount and remount to get the mode properly to
> > make my utility program to display information properly. Once it starts
> > getting proper mode value, it continues.
> >
> > So I am suspecting, even after calling fsync (which says it would block
> > untill it flushes metadata information to disk ), is not really flushing. So
> > only during unmount, it flushes metadata and hence I could get dimode
> > properly. since after remounting , by reading metadata information , I could
> > get mode properly and differentiate directory or regular file, and also it
> > is filling magic etc. properly, I feel the data I am reading is right and
> > that I could compare with stat system call and ls commands.
> >
> > If I am doing something wrong and no problem with XFS, then I should not
> > get mode field properly even after unmount/remount operation.
> >
> > Is there any problem with XFS fsync? Why dimode is getting updated only
> > during unmount? why not when I call fsync? Because fsync says it has to
> > flush all meta dat to disk before existing.
> >
> > Please let me know your feedback.
> >
>
>
[[HTML alternate version deleted]]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
2008-01-14 12:24 ` Gopala Krishna
@ 2008-01-14 14:06 ` Andi Kleen
2008-01-14 14:32 ` Olaf Frączyk
` (3 subsequent siblings)
5 siblings, 0 replies; 22+ messages in thread
From: Andi Kleen @ 2008-01-14 14:06 UTC (permalink / raw)
To: Gopala Krishna; +Cc: xfs
"Gopala Krishna" <gopalakrishna.n.m@gmail.com> writes:
> ======
> Basically I am extracting metadata information for a given file by reading
> the inode structure from the particular disk offset (based on it's position
> calculated by published inode structure and super block structure
> information). Before reading the metada data information from the disk, I
> am calling fsync (I used to call sync, but later I changed to fsync, since
> sync is not guranteed to flush all meta data)
sync is guaranteed to flush all metadata. But it has other problems
like livelocks.
to ensure all metadata
> related to file is flushed to disk. Later I am reading particular disk
> offset as per calculation. I am getting XFS magic field properly after
> mapping to XFs inode structure. However I am not getting dimode properly in
> some cases (not all cases) and it shows 00000 even for regular file and
> directory.
I suspect it's flushed to the log only. You could probably write some other
metadata until the log is completely full and fsync it, then eventually
the first change should be guaranteed to be flushed to the rest of
the disk.
> If I am doing something wrong
Well yes it sounds certainly weird what you're attempting.
-Andi
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
2008-01-14 12:24 ` Gopala Krishna
2008-01-14 14:06 ` Andi Kleen
@ 2008-01-14 14:32 ` Olaf Frączyk
2008-01-14 14:43 ` ***** SUSPECTED SPAM ***** " Matthias Schniedermeyer
` (2 subsequent siblings)
5 siblings, 0 replies; 22+ messages in thread
From: Olaf Frączyk @ 2008-01-14 14:32 UTC (permalink / raw)
To: Gopala Krishna; +Cc: xfs
On Mon, 2008-01-14 at 17:44 +0530, Gopala Krishna wrote:
> So I am suspecting, even after calling fsync (which says it would block
> untill it flushes metadata information to disk ), is not really flushing. So
> only during unmount, it flushes metadata and hence I could get dimode
> properly. since after remounting , by reading metadata information , I could
> get mode properly and differentiate directory or regular file, and also it
> is filling magic etc. properly, I feel the data I am reading is right and
> that I could compare with stat system call and ls commands.
The metadata are put in log. So they are on disk. Just not in the place
you expect them to find.
>
> If I am doing something wrong and no problem with XFS, then I should not get
> mode field properly even after unmount/remount operation.
At remount the log is replayed and the metadata are in the place where
you expect them to be.
>
> Is there any problem with XFS fsync? Why dimode is getting updated only
> during unmount? why not when I call fsync? Because fsync says it has to
> flush all meta dat to disk before existing.
And it does.
It is not XFS problem. It is your problem ;)
BTW, the GRUB does similiar thing. And many people reported problems
about it.
Regards,
Olaf
^ permalink raw reply [flat|nested] 22+ messages in thread* ***** SUSPECTED SPAM ***** Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
` (2 preceding siblings ...)
2008-01-14 14:32 ` Olaf Frączyk
@ 2008-01-14 14:43 ` Matthias Schniedermeyer
2008-01-14 17:55 ` Chris Wedgwood
2008-01-14 22:42 ` David Chinner
5 siblings, 0 replies; 22+ messages in thread
From: Matthias Schniedermeyer @ 2008-01-14 14:43 UTC (permalink / raw)
To: Gopala Krishna; +Cc: xfs
On 14.01.2008 17:44, Gopala Krishna wrote:
> Hi,
> I am seeing some strange problem with XFS and would like to know the
> expected behavior and if it is faulty is there any patches to resolve the
> problem.
>
> Problem:
> ======
...
The man-page "xfs_freeze" at least reads like it does what you want,
i.e. it flushes everything(tm).
Bis denn
--
Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
` (3 preceding siblings ...)
2008-01-14 14:43 ` ***** SUSPECTED SPAM ***** " Matthias Schniedermeyer
@ 2008-01-14 17:55 ` Chris Wedgwood
2008-01-14 22:42 ` David Chinner
5 siblings, 0 replies; 22+ messages in thread
From: Chris Wedgwood @ 2008-01-14 17:55 UTC (permalink / raw)
To: Gopala Krishna; +Cc: xfs
On Mon, Jan 14, 2008 at 05:44:22PM +0530, Gopala Krishna wrote:
> Is there any problem with XFS fsync? Why dimode is getting updated
> only during unmount? why not when I call fsync? Because fsync says
> it has to flush all meta dat to disk before existing.
it's probably in the log
if you must poke about under the fs like this, try doing
freeze/unfreeze (this is what i suggested to the grub people years
ago, but i'm not sure it ever made it upstream)
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Question related to XFS sync , especially fsync
2008-01-14 12:14 Question related to XFS sync , especially fsync Gopala Krishna
` (4 preceding siblings ...)
2008-01-14 17:55 ` Chris Wedgwood
@ 2008-01-14 22:42 ` David Chinner
2008-01-15 13:44 ` Gopala Krishna
5 siblings, 1 reply; 22+ messages in thread
From: David Chinner @ 2008-01-14 22:42 UTC (permalink / raw)
To: Gopala Krishna; +Cc: xfs
On Mon, Jan 14, 2008 at 05:44:22PM +0530, Gopala Krishna wrote:
> Hi,
> I am seeing some strange problem with XFS and would like to know the
> expected behavior and if it is faulty is there any patches to resolve the
> problem.
>
> Problem:
> ======
> Basically I am extracting metadata information for a given file by reading
> the inode structure from the particular disk offset (based on it's position
> calculated by published inode structure and super block structure
> information). Before reading the metada data information from the disk, I
> am calling fsync (I used to call sync, but later I changed to fsync, since
> sync is not guranteed to flush all meta data) to ensure all metadata
> related to file is flushed to disk. Later I am reading particular disk
> offset as per calculation. I am getting XFS magic field properly after
> mapping to XFs inode structure. However I am not getting dimode properly in
> some cases (not all cases) and it shows 00000 even for regular file and
> directory.
How are you finding and reading the inode off disk?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Question related to XFS sync , especially fsync
2008-01-14 22:42 ` David Chinner
@ 2008-01-15 13:44 ` Gopala Krishna
2008-01-15 15:18 ` Eric Sandeen
0 siblings, 1 reply; 22+ messages in thread
From: Gopala Krishna @ 2008-01-15 13:44 UTC (permalink / raw)
To: David Chinner, Chris Wedgwood, Matthias Schniedermeyer,
Olaf Frączyk, Andi Kleen
Cc: xfs
Hi All,
Thanks a lot for your response.
I never thought it might be in a log and not flushed to disk.
Very good clue.
>>>It is not XFS problem. It is your problem ;)
Good comment. Agreed : -).
>>How are you finding and inode off disk
I have lot of code getting in to that. To explain that I have to go through
that complex part of the code to explain in detail.
Basically once we get indoe number for a given file from the available
system call, we only depending upon the XFS layout and it's structure. We
are reading super block from a particular disk offset and calculating
address for inode offset and its address on the disk and reading directly
from the disk offset. We are totally depending on XFS on disk layout.
To get very much detail , step by step , I have to go through complete code
and lot of calculation involved in this process. But it is going fine in
most of the cases except when new files are copied and all of you answered
for that.
Thanks alot for your respopnse.
-Gopal.
On 1/15/08, David Chinner <dgc@sgi.com> wrote:
>
> On Mon, Jan 14, 2008 at 05:44:22PM +0530, Gopala Krishna wrote:
> > Hi,
> > I am seeing some strange problem with XFS and would like to know the
> > expected behavior and if it is faulty is there any patches to resolve
> the
> > problem.
> >
> > Problem:
> > ======
> > Basically I am extracting metadata information for a given file by
> reading
> > the inode structure from the particular disk offset (based on
> it's position
> > calculated by published inode structure and super block structure
> > information). Before reading the metada data information from the disk,
> I
> > am calling fsync (I used to call sync, but later I changed to fsync,
> since
> > sync is not guranteed to flush all meta data) to ensure all metadata
> > related to file is flushed to disk. Later I am reading particular disk
> > offset as per calculation. I am getting XFS magic field properly after
> > mapping to XFs inode structure. However I am not getting dimode properly
> in
> > some cases (not all cases) and it shows 00000 even for regular file and
> > directory.
>
> How are you finding and reading the inode off disk?
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> Principal Engineer
> SGI Australian Software Group
>
[[HTML alternate version deleted]]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Question related to XFS sync , especially fsync
2008-01-15 13:44 ` Gopala Krishna
@ 2008-01-15 15:18 ` Eric Sandeen
2008-01-15 22:26 ` Nathan Scott
0 siblings, 1 reply; 22+ messages in thread
From: Eric Sandeen @ 2008-01-15 15:18 UTC (permalink / raw)
To: Gopala Krishna
Cc: David Chinner, Chris Wedgwood, Matthias Schniedermeyer,
Olaf Fra;czyk, Andi Kleen, xfs
Gopala Krishna wrote:
> Hi All,
> Thanks a lot for your response.
> I never thought it might be in a log and not flushed to disk.
> Very good clue.
>
>>>> It is not XFS problem. It is your problem ;)
> Good comment. Agreed : -).
>
>>> How are you finding and inode off disk
>
> I have lot of code getting in to that. To explain that I have to go through
> that complex part of the code to explain in detail.
>
> Basically once we get indoe number for a given file from the available
> system call, we only depending upon the XFS layout and it's structure. We
> are reading super block from a particular disk offset and calculating
> address for inode offset and its address on the disk and reading directly
> from the disk offset. We are totally depending on XFS on disk layout.
Can I ask why you are doing this? :)
-Eric
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Question related to XFS sync , especially fsync
2008-01-15 15:18 ` Eric Sandeen
@ 2008-01-15 22:26 ` Nathan Scott
2008-01-16 6:43 ` Gopala Krishna
0 siblings, 1 reply; 22+ messages in thread
From: Nathan Scott @ 2008-01-15 22:26 UTC (permalink / raw)
To: Gopala Krishna
Cc: Eric Sandeen, David Chinner, Chris Wedgwood,
Matthias Schniedermeyer, Olaf Fra;czyk, Andi Kleen, xfs
On Tue, 2008-01-15 at 09:18 -0600, Eric Sandeen wrote:
>
> > I have lot of code getting in to that. To explain that I have to go
> through
> > that complex part of the code to explain in detail.
> >
> > Basically once we get indoe number for a given file from the
> available
> > system call, we only depending upon the XFS layout and it's
> structure. We
> > are reading super block from a particular disk offset and
> calculating
> > address for inode offset and its address on the disk and reading
> directly
> > from the disk offset. We are totally depending on XFS on disk
> layout.
>
> Can I ask why you are doing this? :)
>
This would be good to know. If you absolutely must use inode numbers
instead of path names, you should use the "by-handle" interface (like
xfsdump, xfs_fsr, etc) and not use the ondisk structures directly -
doing so is always "broken by design" and you'll get little sympathy
here for doing so. :)
cheers.
--
Nathan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Question related to XFS sync , especially fsync
2008-01-15 22:26 ` Nathan Scott
@ 2008-01-16 6:43 ` Gopala Krishna
[not found] ` <20080116064840.GA5725@puku.stupidest.org>
0 siblings, 1 reply; 22+ messages in thread
From: Gopala Krishna @ 2008-01-16 6:43 UTC (permalink / raw)
To: nscott; +Cc: xfs
Is there any XFS call from user level to flush metadata for a given file or
complete log to disk?
Thanks,
Gopal.
On 1/16/08, Nathan Scott <nscott@aconex.com> wrote:
>
> On Tue, 2008-01-15 at 09:18 -0600, Eric Sandeen wrote:
> >
> > > I have lot of code getting in to that. To explain that I have to go
> > through
> > > that complex part of the code to explain in detail.
> > >
> > > Basically once we get indoe number for a given file from the
> > available
> > > system call, we only depending upon the XFS layout and it's
> > structure. We
> > > are reading super block from a particular disk offset and
> > calculating
> > > address for inode offset and its address on the disk and reading
> > directly
> > > from the disk offset. We are totally depending on XFS on disk
> > layout.
> >
> > Can I ask why you are doing this? :)
> >
>
> This would be good to know. If you absolutely must use inode numbers
> instead of path names, you should use the "by-handle" interface (like
> xfsdump, xfs_fsr, etc) and not use the ondisk structures directly -
> doing so is always "broken by design" and you'll get little sympathy
> here for doing so. :)
>
> cheers.
>
> --
> Nathan
>
>
[[HTML alternate version deleted]]
^ permalink raw reply [flat|nested] 22+ messages in thread