[LTP] [PATCH] syscalls/statx06: use a fine-grained timestamp for the second time fetch

Jeff Layton jlayton@kernel.org
Fri May 19 12:07:51 CEST 2023


On Fri, 2023-05-19 at 09:16 +0000, Yang Xu (Fujitsu) wrote:
> 
> on 2023/05/18 19:32, Jeff Layton wrote:
> > I have a patchset in progress to change the kernel to sometimes use
> > fine-grained timestamps for the mtime/ctime. With this, the statx06 test
> > sometimes fails.
> > 
> > Change the test to grab a fine-grained timestamp for the "after" value,
> > which fixes the issue.
> 
> Now, it is not a right time to review this patch,  I prefer to review 
> this when your kernel patchset is merged into linux master or 
> linux-next. Then we can add a comment or a kernel commit id to explain 
> this..
> 
> 

Fair enough. I don't think there is any issue with taking this patch in
earlier however.

The problem with this test is that it makes the assumption that coarse-
grained timestamps are sufficient to bracket a filesystem operation.
While that has largely been true in the past, it's certainly not
specified by any standard.

> > 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >   testcases/kernel/syscalls/statx/statx06.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
> > index ce82b905bebd..fa75982b0901 100644
> > --- a/testcases/kernel/syscalls/statx/statx06.c
> > +++ b/testcases/kernel/syscalls/statx/statx06.c
> > @@ -109,7 +109,7 @@ static void test_statx(unsigned int test_nr)
> >   	clock_wait_tick();
> >   	tc->operation();
> >   	clock_wait_tick();
> > -	SAFE_CLOCK_GETTIME(CLOCK_REALTIME_COARSE, &after_time);
> > +	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &after_time);
> >   
> >   	TEST(statx(AT_FDCWD, TEST_FILE, 0, STATX_ALL, &buff));
> >   	if (TST_RET != 0) {

-- 
Jeff Layton <jlayton@kernel.org>


More information about the ltp mailing list