Bug 762562 (GLUSTER-830)

Summary: SETATTR: set atime/mtime after truncate?
Product: [Community] GlusterFS Reporter: Krishna Srinivas <krishna>
Component: fuseAssignee: Csaba Henk <csaba>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: mainlineCC: amarts, gluster-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Csaba Henk 2010-04-18 20:42:41 UTC
(In reply to comment #0)
> when atime/mtime that is to be set is sent along with truncate, shouldn't we do
> the truncate operation first? In the code truncate is done in the end which
> negates the effect of setting of atime and mtime.

How can be such a thing triggered? Is there an operation on the filesystem which implies sending a SETATTR with *time + truncate at the same time? Or is it a theoretical problem?

Comment 1 Krishna Srinivas 2010-04-18 20:55:04 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > when atime/mtime that is to be set is sent along with truncate, shouldn't we do
> > the truncate operation first? In the code truncate is done in the end which
> > negates the effect of setting of atime and mtime.
> 
> How can be such a thing triggered? Is there an operation on the filesystem
> which implies sending a SETATTR with *time + truncate at the same time? Or is
> it a theoretical problem?

I do not know if it can be triggered, just theoritical.

Under what circumstances can truncate be tugged along with other SETATTR calls? What is the primary reason for the kernel to combine the calls? just optimization?

Comment 2 Csaba Henk 2010-04-18 21:10:46 UTC
(In reply to comment #2)
> I do not know if it can be triggered, just theoritical.
> 
> Under what circumstances can truncate be tugged along with other SETATTR calls?
> What is the primary reason for the kernel to combine the calls? just
> optimization?

I think so. What I can recall now, truncate, utime, chmod, chown (and variants) are the syscalls which imply setattr fop being invoked, and each of these modifies only one kind of attribute.

Comment 3 Krishna Srinivas 2010-04-18 23:28:07 UTC
when atime/mtime that is to be set is sent along with truncate, shouldn't we do the truncate operation first? In the code truncate is done in the end which negates the effect of setting of atime and mtime.

Comment 4 Amar Tumballi 2010-05-04 08:40:59 UTC
As per standard (posix), only when setuid/setgid is set on a file, and you do truncate(), then chmod is triggered together with truncate(), not utimes().

Marking invalid.