Skip to contentSkip to conversation

2.6 open(O_EXCL) sets silly mtime

PATCH In review Olaf Kirch 2 participants 3 messages Apr 20, 2004 – Apr 21, 2004

Subsystems (2)
lore
Share & tools
lore

Olaf Kirch

author
#0 lore raw

PATCH 1/1 2.6 open(O_EXCL) sets silly mtime

Hi,

the attached patch (relative to 2.6.5) is required to make sure a file created with O_EXCL gets the proper mtime.

Olaf

Signature · 3 lines
Olaf Kirch     |  The Hardware Gods hate me.
[email protected]   |
---------------+ 
fs/nfs/nfs3proc.c renamed from fs/nfs/nfs3proc.c.excl +3 -0
@@ -375,6 +375,9 @@
 		};
 		dprintk("NFS call  setattr (post-create)\n");
 
+		if (!(sattr->ia_valid & ATTR_MTIME_SET))
+			sattr->ia_valid |= ATTR_MTIME;
+
 		/* Note: we could use a guarded setattr here, but I'm
 		 * not sure this buys us anything (and I'd have
 		 * to revamp the NFSv3 XDR code) */
#1 lore raw
Quoted 4 lines · Olaf Kirch

Hi,

the attached patch (relative to 2.6.5) is required to make sure a file created with O_EXCL gets the proper mtime.

Well spotted. Should we also do the same for atime? AFAICS the server is allowed to trash that too.

Hmm... Looking at the NFSv4 code, we really need to fix the same issues up there too.

Cheers,
Trond

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#2 lore raw
Quoted 5 lines · Trond Myklebust
Quoted 2 lines

the attached patch (relative to 2.6.5) is required to make sure a file created with O_EXCL gets the proper mtime.

Well spotted. Should we also do the same for atime? AFAICS the server is allowed to trash that too.

If the spec says so, we should make sure atime gets set as well, yes. I only fixed the mntime case because that's what the Linux nfsd clobbers.

Olaf

Signature · 13 lines
Olaf Kirch     |  The Hardware Gods hate me.
[email protected]   |
---------------+ 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs