xfs
[Top] [All Lists]

Re: attr_set() Changes ctime

To: "Quang Nguyen (Ngo)" <quang.nguyen@xxxxxxxxxxxx>
Subject: Re: attr_set() Changes ctime
From: Timothy Shimmin <tes@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Dec 2001 14:49:05 +1100
Cc: "''linux-xfs@xxxxxxxxxxx' '" <linux-xfs@xxxxxxxxxxx>
In-reply-to: <ACD4093EB009D411BC8A009027D7699660A16B@mail.tapeware.com>; from quang.nguyen@tapeware.com on Thu, Dec 06, 2001 at 05:18:24PM -0800
References: <ACD4093EB009D411BC8A009027D7699660A16B@mail.tapeware.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
Hi Quang,

On Thu, Dec 06, 2001 at 05:18:24PM -0800, Quang Nguyen (Ngo) wrote:
> Does anyone have an answer to this question? ;-)
Yep.

> 
> Thanks,
> Quang 
> 
> -----Original Message-----
> From: Quang Nguyen (Ngo)
> To: 'linux-xfs@xxxxxxxxxxx'
> Sent: 12/6/01 11:21 AM
> Subject: attr_set() Changes ctime
> 
> How do I prevent attr_set() from changing the ctime?  
> I have a feeling that the answer is "you can't".  
Yep, you can't.
The relevant code in xfs_attr_set() is:

        if (!error && (flags & ATTR_KERNOTIME) == 0) {
                xfs_ichgtime(dp, XFS_ICHGTIME_CHG);
        }

So one would need ATTR_KERNNOTIME set on the flags for the setting
of the attribute.
This is done by the dmapi code in the kernel.
HOWEVER, it can't be done in userspace as we test to make sure
that only valid flags are possibly set: 
i.e ATTR_ROOT, ATTR_DONTFOLLOW, and for set op: ATTR_CREATE, ATTR_REPLACE

    linvfs_attrctl():
    ...
        int flags = ops[i].flags;
        /* common flags */
        flags &= ~(ATTR_ROOT | ATTR_DONTFOLLOW);
        /* command specific */
        if (ops[i].opcode == ATTR_OP_SET)
                flags &= ~(ATTR_CREATE | ATTR_REPLACE);
        if (flags != 0x0)
                return -EINVAL;

> utime() allows to change mtime and atime of a file.  
> Is there a function to change the ctime especially for XFS?
Not that I know of ??

--Tim


<Prev in Thread] Current Thread [Next in Thread>