Re: [PATCH 8/8] net: sunrpc: Replace CURRENT_TIME by current_fs_time()
From: Deepa Dinamani
Date: Mon Feb 22 2016 - 10:47:36 EST
On Mon, Feb 22, 2016 at 9:04 PM, Trond Myklebust
<trond.myklebust@xxxxxxxxxxxxxxx> wrote:
> On Mon, Feb 22, 2016 at 10:17 AM, Deepa Dinamani <deepa.kernel@xxxxxxxxx> wrote:
>>
>> CURRENT_TIME macro is not appropriate for filesystems as it
>> doesn't use the right granularity for filesystem timestamps.
>> Use current_fs_time() instead.
>>
>> Signed-off-by: Deepa Dinamani <deepa.kernel@xxxxxxxxx>
>> Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx>
>> Cc: Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
>> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
>> Cc: Anna Schumaker <anna.schumaker@xxxxxxxxxx>
>> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
>> Cc: linux-nfs@xxxxxxxxxxxxxxx
>> Cc: netdev@xxxxxxxxxxxxxxx
>> ---
>> net/sunrpc/rpc_pipe.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
>> index 31789ef..bab3187 100644
>> --- a/net/sunrpc/rpc_pipe.c
>> +++ b/net/sunrpc/rpc_pipe.c
>> @@ -477,7 +477,9 @@ rpc_get_inode(struct super_block *sb, umode_t mode)
>> return NULL;
>> inode->i_ino = get_next_ino();
>> inode->i_mode = mode;
>> - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
>> + inode->i_atime = current_fs_time(sb);
>> + inode->i_mtime = inode->i_atime;
>> + inode->i_ctime = inode->i_atime;
>> switch (mode & S_IFMT) {
>> case S_IFDIR:
>> inode->i_fop = &simple_dir_operations;
>
> Why would we care? This is a pseudo-fs. There is no expectation w.r.t.
> timestamp accuracy or resolution.
CURRENT_TIME is not y2038 safe.
We are switching all vfs timestamps to use 64 bit time.
And, deleting all references to CURRENT_TIME.
So CURRENT_TIME users will be replaced by either ktime_get_* apis
or current_fs_time_* apis.
There is going to be another series (based on
https://lkml.org/lkml/2016/2/12/76)
which switches vfs time to 64 bit.
This means [a,c,m] times in struct inode, struct attr and struct kstat
will be changed to use timespec64.
Even though this is a psuedo-fs, we choose to use filesystem apis
rather than ktime_get_* apis as current_fs_time_* apis will switch time
data types together with vfs.
-Deepa