Bug 762562 (GLUSTER-830) - SETATTR: set atime/mtime after truncate?
Summary: SETATTR: set atime/mtime after truncate?
Keywords:
Status: CLOSED NOTABUG
Alias: GLUSTER-830
Product: GlusterFS
Classification: Community
Component: fuse
Version: mainline
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Csaba Henk
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-18 23:28 UTC by Krishna Srinivas
Modified: 2015-12-01 16:45 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.