generic: new testcases for delegation support
v3 cover generic: new testcases for delegation support
The main difference from the last set are just changes to address Zorro's review comments.
Support for delegations has been merged into mainline, but there is still an outstanding bugfix [1] that will need to be merged before the file delegation test passes properly.
[1]: https://lore.kernel.org/linux-fsdevel/[email protected]/
---
Changes in v3:
- Clean up per Zorro's comments
- Use ./new to generate boilerplate test scripts
- Add both tests to "locks" and "quick" groups
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Add tests for file delegations
- Clean up after testing whether leases are supported
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Jeff Layton (3):
common/rc: clean up after the _require_test_fcntl_setlease() test
generic: add tests for directory delegations
generic: add tests for file delegations
common/locktest | 19 +- common/rc | 11 + src/locktest.c | 621 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/783 | 19 ++ tests/generic/783.out | 2 + tests/generic/784 | 20 ++ tests/generic/784.out | 2 + 7 files changed, 679 insertions(+), 15 deletions(-)
---
base-commit: 5b75444bc9123f261e0aa95f72328af4c827786a
change-id: 20251111-dir-deleg-ff05013ca540
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
PATCH v3 1/3 common/rc: clean up after the _require_test_fcntl_setlease() test
Remove setlease_testfile after validating whether a lease can be set.
--- common/rc | 1 + 1 file changed, 1 insertion(+)
common/rc +1 -0
@@ -4656,6 +4656,7 @@ _require_test_fcntl_setlease() touch $TEST_DIR/setlease_testfile $here/src/locktest -t $TEST_DIR/setlease_testfile >/dev/null 2>&1 local ret=$? + rm -f $TEST_DIR/setlease_testfile [ $ret -eq 22 ] && _notrun "Require fcntl setlease support" [ "$FSTYP" == "nfs" -a $ret -eq 11 ] && \ _notrun "NFS requires delegation before setlease"
Signature · 1 line
2.52.0
Re: [PATCH fstests v3 1/3] common/rc: clean up after the _require_test_fcntl_setlease() test
Quoted 4 lines · Jeff Layton
Remove
setlease_testfileafter validating whether a lease can be set.Signed-off-by Jeff Layton <[email protected]>---
Thanks Jeff, this version is good to me. As this feature has been in mainline linux, I'd like to merge this patchset in next fstests release to get this coverage.
Quoted 19 lines
common/rc | 1 + 1 file changed, 1 insertion(+)common/rc +1
-0@@ -4656,6 +4656,7 @@ _require_test_fcntl_setlease() touch $TEST_DIR/setlease_testfile $here/src/locktest -t $TEST_DIR/setlease_testfile >/dev/null 2>&1 local ret=$? + rm -f $TEST_DIR/setlease_testfile [ $ret -eq 22 ] && _notrun "Require fcntl setlease support" [ "$FSTYP" == "nfs" -a $ret -eq 11 ] && \ _notrun "NFS requires delegation before setlease"Signature · 2 lines
-- 2.52.0
PATCH v3 2/3 generic: add tests for directory delegations
In reply to Jeff LaytonWith the advent of directory delegation support coming to the kernel, add support for testing them to the existing locktest.c program, and add testcases for all of the different ways that they can be broken.
--- common/locktest | 14 +- common/rc | 10 ++ src/locktest.c | 423 ++++++++++++++++++++++++++++++++++++++++++++++++-- tests/generic/783 | 19 +++ tests/generic/783.out | 2 + 5 files changed, 453 insertions(+), 15 deletions(-)
common/locktest +11 -3
@@ -6,6 +6,7 @@ SERVER_LOG=$TEST_DIR/server.out SERVER_PORT=$TEST_DIR/server.port CLIENT_LOG=$TEST_DIR/client.out TESTFILE=$TEST_DIR/lock_file +DELEGDIR=$TEST_DIR/dirdeleg client_pid="" server_pid=""
@@ -13,7 +14,7 @@ _cleanup() { kill $client_pid > /dev/null 2>&1 kill $server_pid > /dev/null 2>&1 - rm -f $TESTFILE + rm -rf $TESTFILE $DELEGDIR } _dump_logs_fail()
@@ -42,8 +43,6 @@ _run_generic() { rm -f $CLIENT_LOG touch $CLIENT_LOG - touch $TESTFILE - # Start the server $here/src/locktest $mode $TESTFILE 2> $SERVER_LOG 1> $SERVER_PORT & server_pid=$!
@@ -87,9 +86,18 @@ _run_generic() { } _run_locktest() { + touch $TESTFILE + _run_generic "" } _run_leasetest() { + touch $TESTFILE + _run_generic "-L" } + +_run_dirdelegtest() { + TESTFILE=$DELEGDIR + _run_generic "-D" +}
common/rc +10 -0
@@ -4662,6 +4662,16 @@ _require_test_fcntl_setlease() _notrun "NFS requires delegation before setlease" } +_require_test_fcntl_setdeleg() +{ + _require_test_program "locktest" + mkdir $TEST_DIR/setdeleg_testdir + $here/src/locktest -t -D $TEST_DIR/setdeleg_testdir >/dev/null 2>&1 + local ret=$? + rm -rf $TEST_DIR/setdeleg_testdir + [ $ret -eq 22 ] && _notrun "Require fcntl setdeleg support" +} + _require_ofd_locks() { # Give a test run by getlk wrlck on testfile.
src/locktest.c +411 -12
569 lines not on this page · raw message
tests/generic/783 new file +19 -0
@@ -0,0 +1,19 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Jeff Layton <[email protected]>. All Rights Reserved. +# +# FS QA Test 783 +# +# Test directory delegation support +# +. ./common/preamble +_begin_fstest auto locks quick + +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_setdeleg + +_run_dirdelegtest +_exit 0
tests/generic/783.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 783 +success!
Signature · 1 line
2.52.0
Re: [PATCH fstests v3 2/3] generic: add tests for directory delegations
Quoted 6 lines · Jeff Layton
With the advent of directory delegation support coming to the kernel, add support for testing them to the existing
locktest.cprogram, and add testcases for all of the different ways that they can be broken.Signed-off-by Jeff Layton <[email protected]>---
This version is good to me,
Quoted 708 lines
common/locktest | 14 +- common/rc | 10 ++ src/locktest.c | 423 ++++++++++++++++++++++++++++++++++++++++++++++++-- tests/generic/783 | 19 +++ tests/generic/783.out | 2 + 5 files changed, 453 insertions(+), 15 deletions(-)common/locktest +11
-3@@ -6,6 +6,7 @@ SERVER_LOG=$TEST_DIR/server.out SERVER_PORT=$TEST_DIR/server.port CLIENT_LOG=$TEST_DIR/client.out TESTFILE=$TEST_DIR/lock_file +DELEGDIR=$TEST_DIR/dirdeleg client_pid="" server_pid=""@@ -13,7 +14,7 @@ _cleanup() { kill $client_pid > /dev/null 2>&1 kill $server_pid > /dev/null 2>&1 - rm -f $TESTFILE + rm -rf $TESTFILE $DELEGDIR } _dump_logs_fail()@@ -42,8 +43,6 @@ _run_generic() { rm -f $CLIENT_LOG touch $CLIENT_LOG - touch $TESTFILE - # Start the server $here/src/locktest $mode $TESTFILE 2> $SERVER_LOG 1> $SERVER_PORT & server_pid=$!@@ -87,9 +86,18 @@ _run_generic() { } _run_locktest() { + touch $TESTFILE + _run_generic "" } _run_leasetest() { + touch $TESTFILE + _run_generic "-L" } + +_run_dirdelegtest() { + TESTFILE=$DELEGDIR + _run_generic "-D" +}common/rc +10
-0@@ -4662,6 +4662,16 @@ _require_test_fcntl_setlease() _notrun "NFS requires delegation before setlease" } +_require_test_fcntl_setdeleg() +{ + _require_test_program "locktest" + mkdir $TEST_DIR/setdeleg_testdir + $here/src/locktest -t -D $TEST_DIR/setdeleg_testdir >/dev/null 2>&1 + local ret=$? + rm -rf $TEST_DIR/setdeleg_testdir + [ $ret -eq 22 ] && _notrun "Require fcntl setdeleg support" +} + _require_ofd_locks() { # Give a test run by getlk wrlck on testfile.src/locktest.c +411
-12@@ -28,6 +28,7 @@#include <errno.h> #include <string.h> #include <signal.h> +#include <limits.h> #define HEX_2_ASC (x) ((x) > 9) ? (x)-10+'a' : (x)+'0'#define FILE_SIZE 1024@@ -60,8 +61,6 @@ extern int h_errno;#define SOCKET_CLOSE (S ) (close(S))#define INVALID_SOCKET -1 -#define O_BINARY 0 -#define HANDLE int#define INVALID_HANDLE -1#define SEEK (H ,O ) (lseek(H, O, SEEK_SET))@@ -78,6 +77,17 @@ extern int h_errno;#define ALLOC_ALIGNED (S ) (memalign(65536, S))#define FREE_ALIGNED (P ) (free(P)) +#ifndef F_GETDELEG +#define F_GETDELEG (1024 + 15) +#define F_SETDELEG (1024 + 16) + +struct delegation { +uint32_t d_flags; +uint16_t d_type; +uint16_t __pad; +}; +#endif +static char *prog;static char *filename =0 ;static int debug =0 ;@@ -86,11 +96,14 @@ static int port = 0;static int testnumber =-1 ;static int saved_errno =0 ;static int got_sigio =0 ; +static int lease_is_deleg =0 ;static SOCKET s_fd =-1 ;/* listen socket */ static SOCKET c_fd =-1 ;/* IPC socket */ static HANDLE f_fd =INVALID_HANDLE ;/* shared file */ +static char *child[] = {"child0" ,"child1" }; +#define CMD_WRLOCK 0#define CMD_RDLOCK 1#define CMD_UNLOCK 2@@ -103,9 +116,19 @@ static HANDLE f_fd = INVALID_HANDLE; /* shared file */#define CMD_SIGIO 9#define CMD_WAIT_SIGIO 10#define CMD_TRUNCATE 11 - -#define PASS 1 -#define FAIL 0 +#define CMD_GETDELEG 12 +#define CMD_SETDELEG 13 +#define CMD_CREATE 14 +#define CMD_UNLINK 15 +#define CMD_RENAME 16 +#define CMD_SYMLINK 17 +#define CMD_MKNOD 18 +#define CMD_CHMOD 19 +#define CMD_MKDIR 20 +#define CMD_RMDIR 21 + +#define PASS 0 +#define FAIL 1#define SERVER 0#define CLIENT 1@@ -119,6 +142,7 @@ static HANDLE f_fd = INVALID_HANDLE; /* shared file */#define FLAGS 2/* index 2 is also used for do_open() flag, see below */ #define ARG FLAGS/* Arguments for Lease operations */ #define TIME FLAGS/* Time for waiting on sigio */ +#define ARG2 3/* second argument for dir operations */ static char *get_cmd_str (int cmd) {@@ -135,6 +159,16 @@ static char *get_cmd_str(int cmd)case CMD_SIGIO :return "Setup SIGIO" ;break ;case CMD_WAIT_SIGIO :return "Wait for SIGIO" ;break ;case CMD_TRUNCATE :return "Truncate" ;break ; +case CMD_SETDELEG :return "Set Delegation" ;break ; +case CMD_GETDELEG :return "Get Delegation" ;break ; +case CMD_CREATE :return "Create" ;break ; +case CMD_UNLINK :return "Remove" ;break ; +case CMD_RENAME :return "Rename" ;break ; +case CMD_SYMLINK :return "Symlink" ;break ; +case CMD_MKNOD :return "Mknod" ;break ; +case CMD_CHMOD :return "Chmod" ;break ; +case CMD_MKDIR :return "Mkdir" ;break ; +case CMD_RMDIR :return "Rmdir" ;break ; }return "unknown" ; }@@ -682,6 +716,123 @@ static int64_t lease_tests[][6] = {0,0,0,0,0,CLIENT} }; +char *dirdeleg_descriptions[] = { +/* 1 */ "Take Read Lease" , +/* 2 */ "Write Lease Should Fail" , +/* 3 */ "Dir Lease Should Be Broken on Create" , +/* 4 */ "Dir Lease Should Be Broken on Unlink" , +/* 5 */ "Dir Lease Should Be Broken on Rename" , +/* 6 */ "Dir Lease Should Be Broken on Symlink" , +/* 7 */ "Dir Lease Should Be Broken on Mknod" , +/* 8 */ "Dir Lease Should Be Broken on Chmod" , +/* 9 */ "Dir Lease Should Be Broken on Mkdir" , +/* 10 */ "Dir Lease Should Be Broken on Rmdir" , +}; + +static int64_t dirdeleg_tests[][6 ] = +/* test # Action [offset|flags|arg] length expected server/client */ +/* [sigio_wait_time] */ +{ +/* Various tests to exercise leases */ + +/* SECTION 1: Simple verification of being able to take leases */ +/* Take Read Lease, and release it */ + {1 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {1 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_SETDELEG ,F_UNLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Write Lease should fail */ + {2 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {2 ,CMD_SETDELEG ,F_WRLCK ,0 ,FAIL ,SERVER }, + {2 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by a create */ + {3 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {3 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {3 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {3 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {3 ,CMD_CREATE ,0 ,0 ,PASS ,CLIENT }, + {3 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {3 ,CMD_UNLINK ,0 ,0 ,PASS ,SERVER }, + {3 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by unlink */ + {4 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {4 ,CMD_CREATE ,0 ,0 ,PASS ,SERVER }, + {4 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {4 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {4 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {4 ,CMD_UNLINK ,0 ,0 ,PASS ,CLIENT }, + {4 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {4 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by rename */ + {5 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {5 ,CMD_CREATE ,0 ,0 ,PASS ,SERVER }, + {5 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {5 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {5 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {5 ,CMD_RENAME ,0 ,1 ,PASS ,CLIENT }, + {5 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {5 ,CMD_UNLINK ,1 ,0 ,PASS ,CLIENT }, + {5 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by symlink */ + {6 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {6 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {6 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {6 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {6 ,CMD_SYMLINK ,0 ,1 ,PASS ,CLIENT }, + {6 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {6 ,CMD_UNLINK ,0 ,0 ,PASS ,CLIENT }, + {6 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by mknod */ + {7 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {7 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {7 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {7 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {7 ,CMD_MKNOD ,0 ,0 ,PASS ,CLIENT }, + {7 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {7 ,CMD_UNLINK ,0 ,0 ,PASS ,CLIENT }, + {7 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by chmod */ + {8 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {8 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {8 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {8 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {8 ,CMD_CHMOD ,0775 ,0 ,PASS ,CLIENT }, + {8 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {8 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by mkdir */ + {9 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {9 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {9 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {9 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {9 ,CMD_MKDIR ,0 ,0 ,PASS ,CLIENT }, + {9 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {9 ,CMD_RMDIR ,0 ,0 ,PASS ,SERVER }, + {9 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when dir lease is broken by rmdir */ + {10 ,CMD_OPEN ,O_DIRECTORY |O_RDONLY ,0 ,PASS ,SERVER }, + {10 ,CMD_MKDIR ,0 ,0 ,PASS ,SERVER }, + {10 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {10 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {10 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {10 ,CMD_RMDIR ,0 ,0 ,PASS ,CLIENT }, + {10 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {10 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* indicate end of array */ + {0 ,0 ,0 ,0 ,0 ,SERVER }, + {0 ,0 ,0 ,0 ,0 ,CLIENT } +}; + static struct { int32_t test; int32_t command;@@ -763,9 +914,14 @@ again:void release_lease (int fd) { +struct delegation deleg = { .d_type =F_UNLCK };int rc; - rc =fcntl (fd,F_SETLEASE ,F_UNLCK ); +if (lease_is_deleg) + rc =fcntl (fd,F_SETDELEG , &deleg); +else + rc =fcntl (fd,F_SETLEASE ,F_UNLCK ); +if (rc !=0 )fprintf (stderr,"%s Failed to remove lease %d : %d %s\n" , __FILE__, rc, errno,strerror (errno));@@ -826,9 +982,39 @@ int do_wait_sigio(int32_t time)return (got_sigio ?PASS :FAIL ); } +int create_directory (void ) +{ +int ret; +struct stat st; + + ret =mkdir (filename,0777 ); +if (ret ==0 ) +return PASS ; + +if (errno !=EEXIST ) { +perror ("directory create" ); +return FAIL ; + } + + ret =stat (filename, &st); +if (ret <0 ) { +perror ("stat" ); +return FAIL ; + } + +if (S_ISDIR (st.st_mode)) +return PASS ; + +fprintf (stderr,"%s is not a directory\n" , filename); +return FAIL ; +} +int do_open (int flag) { -int flags = flag|O_CREAT |O_BINARY ; +int flags = flag; + +if (!(flag &O_DIRECTORY )) + flags |=O_CREAT ;if (debug >1 )fprintf (stderr,"do_open %s 0x%x\n" , filename, flags);@@ -841,6 +1027,103 @@ int do_open(int flag)return PASS ; } +int do_create (int idx) +{ +int fd; + + fd =openat (f_fd, child[idx],O_WRONLY |O_CREAT ,0666 ); +if (fd <0 ) { +perror ("openat" ); +return FAIL ; + } +close (fd); +return PASS ; +} + +int do_unlink (int idx) +{ +int ret; + + ret =unlinkat (f_fd, child[idx],0 ); +if (ret <0 ) { +perror ("unlink" ); +return FAIL ; + } +return PASS ; +} + +int do_rename (int old,int new) +{ +int ret; + + ret =renameat (f_fd, child[old], f_fd, child[new]); +if (ret <0 ) { +perror ("rename" ); +return FAIL ; + } +return PASS ; +} + +int do_symlink (int path,int target) +{ +int ret; + + ret =symlinkat (child[target], f_fd, child[path]); +if (ret <0 ) { +perror ("symlink" ); +return FAIL ; + } +return PASS ; +} + +int do_mknod (int idx) +{ +int ret; + + ret =mknodat (f_fd, child[idx],S_IFREG ,0 ); +if (ret <0 ) { +perror ("mknod" ); +return FAIL ; + } +return PASS ; +} + +int do_mkdir (int idx) +{ +int ret; + + ret =mkdirat (f_fd, child[idx],0777 ); +if (ret <0 ) { +perror ("mkdir" ); +return FAIL ; + } +return PASS ; +} + +int do_rmdir (int idx) +{ +int ret; + + ret =unlinkat (f_fd, child[idx],AT_REMOVEDIR ); +if (ret <0 ) { +perror ("mkdir" ); +return FAIL ; + } +return PASS ; +} + +int do_chmod (int mode) +{ +int ret; + + ret =chmod (filename, mode); +if (ret <0 ) { +perror ("chmod" ); +return FAIL ; + } +return PASS ; +} +static int do_lock (int cmd,int type,int start,int length) {int ret;@@ -884,6 +1167,7 @@ static int do_lease(int cmd, int arg, int expected) errno =0 ; + lease_is_deleg =0 ; ret =fcntl (f_fd, cmd, arg); saved_errno = errno;@@ -897,6 +1181,37 @@ static int do_lease(int cmd, int arg, int expected)return (ret==0 ?PASS :FAIL ); } +static int do_deleg (int cmd,unsigned short arg,int expected) +{ +struct delegation deleg = { .d_type = arg }; +int ret; + +if (debug >1 ) +fprintf (stderr,"do_deleg: cmd=%d arg=%d exp=%X\n" , + cmd, arg, expected); + +if (f_fd <0 ) +return f_fd; + + errno =0 ; + + lease_is_deleg =1 ; + ret =fcntl (f_fd, cmd, &deleg); + saved_errno = errno; + +if (cmd ==F_GETDELEG && ret ==0 ) + ret = deleg.d_type; + +if (expected && (expected == ret)) + ret =0 ; + +if (ret) +fprintf (stderr,"%s do_deleg: ret = %d, errno = %d (%s)\n" , + __FILE__, ret, errno,strerror (errno)); + +return (ret==0 ?PASS :FAIL ); +} +int do_close (void ) {if (debug >1 ) {@@ -1020,6 +1335,7 @@ main(int argc, char *argv[]) {int i, sts;int c; +int openflags;struct sockaddr_in myAddr;struct linger noLinger = {1 ,0 };char *host =NULL ;@@ -1030,6 +1346,7 @@ main(int argc, char *argv[])extern int optind;int fail_count =0 ;int run_leases =0 ; +int run_dirdelegs =0 ;int test_setlease =0 ;atexit (cleanup);@@ -1043,13 +1360,17 @@ main(int argc, char *argv[]) prog = p+1 ; } -while ((c =getopt (argc, argv,"dLn:h:p:t?" )) !=EOF ) { +while ((c =getopt (argc, argv,"dDLn:h:p:t?" )) !=EOF ) {switch (c) {case 'd' :/* debug flag */ debug++;break ; +case 'D' : + run_dirdelegs =1 ; +break ; +case 'L' :/* Lease testing */ run_leases =1 ;break ;@@ -1090,13 +1411,29 @@ main(int argc, char *argv[]) } filename=argv[optind]; + +if (run_dirdelegs &&create_directory () ==FAIL ) +exit (1 ); +if (debug)fprintf (stderr,"Working on file : %s\n" , filename); -if (do_open (O_RDWR ) ==FAIL ) + +if (run_dirdelegs) { + openflags =O_RDONLY |O_DIRECTORY ; + }else { + openflags =O_RDWR ; + } + +if (do_open (openflags) ==FAIL )exit (1 );if (test_setlease ==1 ) { -fcntl (f_fd,F_SETLEASE ,F_UNLCK ); +struct delegation deleg = { .d_type =F_UNLCK }; + +if (run_dirdelegs) +fcntl (f_fd,F_SETDELEG , &deleg); +else +fcntl (f_fd,F_SETLEASE ,F_UNLCK ); saved_errno = errno;close (f_fd);exit (saved_errno);@@ -1220,7 +1557,7 @@ main(int argc, char *argv[])SRAND (6789L ); } -if (server) +if (server && !run_dirdelegs)/* only server need do shared file */ initialize (f_fd);@@ -1229,7 +1566,9 @@ main(int argc, char *argv[])* * real work is in here ... */ -if (run_leases) +if (run_dirdelegs) + fail_count =run (dirdeleg_tests, dirdeleg_descriptions); +else if (run_leases) fail_count =run (lease_tests, lease_descriptions);else fail_count =run (lock_tests, lock_descriptions);@@ -1304,6 +1643,36 @@ int run(int64_t tests[][6], char *descriptions[])case CMD_TRUNCATE : result =do_truncate (tests[index][OFFSET ]);break ; +case CMD_SETDELEG : + result =do_deleg (F_SETDELEG , tests[index][ARG ],0 ); +break ; +case CMD_GETDELEG : + result =do_deleg (F_GETDELEG , tests[index][ARG ], tests[index][ARG ]); +break ; +case CMD_CREATE : + result =do_create (tests[index][ARG ]); +break ; +case CMD_UNLINK : + result =do_unlink (tests[index][ARG ]); +break ; +case CMD_RENAME : + result =do_rename (tests[index][ARG ], tests[index][ARG2 ]); +break ; +case CMD_SYMLINK : + result =do_symlink (tests[index][ARG ], tests[index][ARG2 ]); +break ; +case CMD_MKNOD : + result =do_mknod (tests[index][ARG ]); +break ; +case CMD_CHMOD : + result =do_chmod (tests[index][ARG ]); +break ; +case CMD_MKDIR : + result =do_mkdir (tests[index][ARG ]); +break ; +case CMD_RMDIR : + result =do_rmdir (tests[index][ARG ]); +break ; }if ( result != tests[index][RESULT ]) { fail_flag++;@@ -1418,6 +1787,36 @@ int run(int64_t tests[][6], char *descriptions[])case CMD_TRUNCATE : result =do_truncate (ctl.offset);break ; +case CMD_SETDELEG : + result =do_deleg (F_SETDELEG , ctl.offset,0 ); +break ; +case CMD_GETDELEG : + result =do_deleg (F_GETDELEG , ctl.offset, ctl.offset); +break ; +case CMD_CREATE : + result =do_create (ctl.offset); +break ; +case CMD_UNLINK : + result =do_unlink (ctl.offset); +break ; +case CMD_RENAME : + result =do_rename (ctl.offset, ctl.length); +break ; +case CMD_SYMLINK : + result =do_symlink (ctl.offset, ctl.length); +break ; +case CMD_MKNOD : + result =do_mknod (ctl.offset); +break ; +case CMD_CHMOD : + result =do_chmod (ctl.offset); +break ; +case CMD_MKDIR : + result =do_mkdir (ctl.offset); +break ; +case CMD_RMDIR : + result =do_rmdir (ctl.offset); +break ; }if ( result != ctl.result ) { fprintf(stderr,"Failure in %d:%s\n",tests/generic/783 new file +19
-0@@ -0,0 +1,19 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Jeff Layton <[email protected]>. All Rights Reserved. +# +# FS QA Test 783 +# +# Test directory delegation support +# +. ./common/preamble +_begin_fstest auto locks quick + +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_setdeleg + +_run_dirdelegtest +_exit 0tests/generic/783.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 783 +success!Signature · 2 lines
-- 2.52.0
PATCH v3 3/3 generic: add tests for file delegations
In reply to Jeff LaytonMostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
--- common/locktest | 5 ++ src/locktest.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/784 | 20 +++++ tests/generic/784.out | 2 + 4 files changed, 227 insertions(+), 2 deletions(-)
common/locktest +5 -0
@@ -101,3 +101,8 @@ _run_dirdelegtest() { TESTFILE=$DELEGDIR _run_generic "-D" } + +_run_filedelegtest() { + TESTFILE=$DELEGDIR + _run_generic "-F" +}
src/locktest.c +200 -2
268 lines not on this page · raw message
tests/generic/784 new file +20 -0
@@ -0,0 +1,20 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Jeff Layton <[email protected]>. All Rights Reserved. +# +# FS QA Test 784 +# +# Test file delegation support +# +. ./common/preamble +_begin_fstest auto quick locks + +# Import common functions. +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_setdeleg + +_run_filedelegtest +_exit 0
tests/generic/784.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 784 +success!
Signature · 1 line
2.52.0
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 5 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>---
This version is good to me. But this test fails without the:
https://lore.kernel.org/linux-fsdevel/[email protected]/
So maybe we can mark that:
_fixed_by_kernel_commit xxxxxxxxxxxx ...
or
_wants_kernel_commit xxxxxxxxxxxx ...
Anyway, we can add that after the patchset get merged. I'll merge this patchset at first.
Quoted 340 lines
common/locktest | 5 ++ src/locktest.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/784 | 20 +++++ tests/generic/784.out | 2 + 4 files changed, 227 insertions(+), 2 deletions(-)common/locktest +5
-0@@ -101,3 +101,8 @@ _run_dirdelegtest() { TESTFILE=$DELEGDIR _run_generic "-D" } + +_run_filedelegtest() { + TESTFILE=$DELEGDIR + _run_generic "-F" +}src/locktest.c +200
-2@@ -126,6 +126,8 @@ static char *child[] = { "child0", "child1" };#define CMD_CHMOD 19#define CMD_MKDIR 20#define CMD_RMDIR 21 +#define CMD_UNLINK_S 22 +#define CMD_RENAME_S 23#define PASS 0#define FAIL 1@@ -169,6 +171,8 @@ static char *get_cmd_str(int cmd)case CMD_CHMOD :return "Chmod" ;break ;case CMD_MKDIR :return "Mkdir" ;break ;case CMD_RMDIR :return "Rmdir" ;break ; +case CMD_UNLINK_S :return "Remove Self" ;break ; +case CMD_RENAME_S :return "Rename Self" ;break ; }return "unknown" ; }@@ -716,6 +720,150 @@ static int64_t lease_tests[][6] = {0,0,0,0,0,CLIENT} }; +char *filedeleg_descriptions[] = { +/* 1 */ "Take Read Deleg" , +/* 2 */ "Take Write Deleg" , +/* 3 */ "Fail Write Deleg if file is open somewhere else" , +/* 4 */ "Fail Read Deleg if opened with write permissions" , +/* 5 */ "Read deleg gets SIGIO on write open" , +/* 6 */ "Write deleg gets SIGIO on read open" , +/* 7 */ "Read deleg does _not_ get SIGIO on read open" , +/* 8 */ "Read deleg gets SIGIO on write open" , +/* 9 */ "Write deleg gets SIGIO on truncate" , +/* 10 */ "Read deleg gets SIGIO on truncate" , +/* 11 */ "Read deleg gets SIGIO on chmod" , +/* 12 */ "Read deleg gets SIGIO on unlink" , +/* 13 */ "Read deleg gets SIGIO on rename" , +}; + +static int64_t filedeleg_tests[][6 ] = +/* test # Action [offset|flags|arg] length expected server/client */ +/* [sigio_wait_time] */ + { +/* Various tests to exercise delegs */ + +/* SECTION 1: Simple verification of being able to take delegs */ +/* Take Read Deleg */ + {1 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + {1 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {1 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {1 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {1 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_SETDELEG ,F_UNLCK ,0 ,PASS ,SERVER }, + {1 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {1 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Take Write Deleg */ + {2 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,SERVER }, + {2 ,CMD_SETDELEG ,F_WRLCK ,0 ,PASS ,SERVER }, + {2 ,CMD_GETDELEG ,F_WRLCK ,0 ,PASS ,SERVER }, + {2 ,CMD_SETDELEG ,F_UNLCK ,0 ,PASS ,SERVER }, + {2 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, +/* Fail Write Deleg with other users */ + {3 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {3 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,SERVER }, + {3 ,CMD_SETDELEG ,F_WRLCK ,0 ,FAIL ,SERVER }, + {3 ,CMD_GETDELEG ,F_WRLCK ,0 ,FAIL ,SERVER }, + {3 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {3 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, +/* Fail Read Deleg if opened for write */ + {4 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,SERVER }, + {4 ,CMD_SETDELEG ,F_RDLCK ,0 ,FAIL ,SERVER }, + {4 ,CMD_GETDELEG ,F_RDLCK ,0 ,FAIL ,SERVER }, + {4 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* SECTION 2: Proper SIGIO notifications */ +/* Get SIGIO when read deleg is broken by write */ + {5 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {5 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {5 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {5 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {5 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,SERVER }, + {5 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,CLIENT }, + {5 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {5 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Get SIGIO when write deleg is broken by read */ + {6 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,CLIENT }, + {6 ,CMD_SETDELEG ,F_WRLCK ,0 ,PASS ,CLIENT }, + {6 ,CMD_GETDELEG ,F_WRLCK ,0 ,PASS ,CLIENT }, + {6 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {6 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {6 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,CLIENT }, + {6 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {6 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Don't get SIGIO when read deleg is taken by read */ + {7 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {7 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {7 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {7 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {7 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {7 ,CMD_WAIT_SIGIO ,5 ,0 ,FAIL ,CLIENT }, + {7 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {7 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Get SIGIO when Read deleg is broken by Write */ + {8 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {8 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {8 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {8 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {8 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,SERVER }, + {8 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,CLIENT }, + {8 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + {8 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Get SIGIO when Write deleg is broken by Truncate */ + {9 ,CMD_OPEN ,O_RDWR ,0 ,PASS ,CLIENT }, + {9 ,CMD_SETDELEG ,F_WRLCK ,0 ,PASS ,CLIENT }, + {9 ,CMD_GETDELEG ,F_WRLCK ,0 ,PASS ,CLIENT }, + {9 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {9 ,CMD_TRUNCATE ,FILE_SIZE /2 ,0 ,PASS ,CLIENT }, + {9 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,CLIENT }, + {9 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Get SIGIO when Read deleg is broken by Truncate */ + {10 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,CLIENT }, + {10 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {10 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,CLIENT }, + {10 ,CMD_SIGIO ,0 ,0 ,PASS ,CLIENT }, + {10 ,CMD_TRUNCATE ,FILE_SIZE /2 ,0 ,PASS ,SERVER }, + {10 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,CLIENT }, + {10 ,CMD_CLOSE ,0 ,0 ,PASS ,CLIENT }, + +/* Get SIGIO when Read deleg is broken by Chmod */ + {11 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {11 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {11 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {11 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {11 ,CMD_CHMOD ,0644 ,0 ,PASS ,CLIENT }, + {11 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {11 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when file is unlinked */ + {12 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {12 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {12 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {12 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {12 ,CMD_UNLINK_S ,0 ,0 ,PASS ,CLIENT }, + {12 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {12 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* Get SIGIO when file is renamed */ + {13 ,CMD_OPEN ,O_RDONLY ,0 ,PASS ,SERVER }, + {13 ,CMD_SETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {13 ,CMD_GETDELEG ,F_RDLCK ,0 ,PASS ,SERVER }, + {13 ,CMD_SIGIO ,0 ,0 ,PASS ,SERVER }, + {13 ,CMD_RENAME_S ,0 ,0 ,PASS ,CLIENT }, + {13 ,CMD_WAIT_SIGIO ,5 ,0 ,PASS ,SERVER }, + {13 ,CMD_CLOSE ,0 ,0 ,PASS ,SERVER }, + +/* indicate end of array */ + {0 ,0 ,0 ,0 ,0 ,SERVER }, + {0 ,0 ,0 ,0 ,0 ,CLIENT } +}; +char *dirdeleg_descriptions[] = {/* 1 */ "Take Read Lease" ,/* 2 */ "Write Lease Should Fail" ,@@ -1124,6 +1272,37 @@ int do_chmod(int mode)return PASS ; } +int do_unlink_self (void ) +{ +int ret; + + ret =unlink (filename); +if (ret <0 ) { +perror ("unlink" ); +return FAIL ; + } +return PASS ; +} + +int do_rename_self (void ) +{ +int ret; +char target[PATH_MAX ]; + + ret =snprintf (target,sizeof (target),"%s2" , filename); +if (ret >=sizeof (target)) { +perror ("snprintf" ); +return FAIL ; + } + + ret =rename (filename, target); +if (ret <0 ) { +perror ("unlink" ); +return FAIL ; + } +return PASS ; +} +static int do_lock (int cmd,int type,int start,int length) {int ret;@@ -1347,6 +1526,7 @@ main(int argc, char *argv[])int fail_count =0 ;int run_leases =0 ;int run_dirdelegs =0 ; +int run_filedelegs =0 ;int test_setlease =0 ;atexit (cleanup);@@ -1360,7 +1540,7 @@ main(int argc, char *argv[]) prog = p+1 ; } -while ((c =getopt (argc, argv,"dDLn:h:p:t?" )) !=EOF ) { +while ((c =getopt (argc, argv,"dDFLn:h:p:t?" )) !=EOF ) {switch (c) {case 'd' :/* debug flag */ @@ -1371,6 +1551,10 @@ main(int argc, char *argv[]) run_dirdelegs =1 ;break ; +case 'F' : + run_filedelegs =1 ; +break ; +case 'L' :/* Lease testing */ run_leases =1 ;break ;@@ -1430,7 +1614,7 @@ main(int argc, char *argv[])if (test_setlease ==1 ) {struct delegation deleg = { .d_type =F_UNLCK }; -if (run_dirdelegs) +if (run_dirdelegs || run_filedelegs)fcntl (f_fd,F_SETDELEG , &deleg);else fcntl (f_fd,F_SETLEASE ,F_UNLCK );@@ -1568,6 +1752,8 @@ main(int argc, char *argv[])*/ if (run_dirdelegs) fail_count =run (dirdeleg_tests, dirdeleg_descriptions); +else if (run_filedelegs) + fail_count =run (filedeleg_tests, filedeleg_descriptions);else if (run_leases) fail_count =run (lease_tests, lease_descriptions);else @@ -1673,6 +1859,12 @@ int run(int64_t tests[][6], char *descriptions[])case CMD_RMDIR : result =do_rmdir (tests[index][ARG ]);break ; +case CMD_UNLINK_S : + result =do_unlink_self (); +break ; +case CMD_RENAME_S : + result =do_rename_self (); +break ; }if ( result != tests[index][RESULT ]) { fail_flag++;@@ -1817,6 +2009,12 @@ int run(int64_t tests[][6], char *descriptions[])case CMD_RMDIR : result =do_rmdir (ctl.offset);break ; +case CMD_UNLINK_S : + result =do_unlink_self (); +break ; +case CMD_RENAME_S : + result =do_rename_self (); +break ; }if ( result != ctl.result ) { fprintf(stderr,"Failure in %d:%s\n",tests/generic/784 new file +20
-0@@ -0,0 +1,20 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Jeff Layton <[email protected]>. All Rights Reserved. +# +# FS QA Test 784 +# +# Test file delegation support +# +. ./common/preamble +_begin_fstest auto quick locks + +# Import common functions. +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_setdeleg + +_run_filedelegtest +_exit 0tests/generic/784.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 784 +success!Signature · 2 lines
-- 2.52.0
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 10 lines · Zorro Lang
Quoted 5 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>---
This version is good to me. But this test fails without the:
https://lore.kernel.org/linux-fsdevel/[email protected]/
Thanks. Yes, that bug is unfortunate. I'm hoping Christian will take that patch in soon so all of the tests will pass.
Quoted 4 lines
So maybe we can mark that:
_fixed_by_kernel_commitxxxxxxxxxxxx ...
Quoted 8 lines
or
_wants_kernel_commitxxxxxxxxxxxx ...Anyway, we can add that after the patchset get merged. I'll merge this patchset at first.
Reviewed-by Zorro Lang <[email protected]>
If you like. This functionality is only in v6.19-rc so far, so there is no released kernel that has this (yet).
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 24 lines · Jeff Layton
Quoted 10 lines · Zorro Lang
Quoted 5 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>---
This version is good to me. But this test fails without the:
https://lore.kernel.org/linux-fsdevel/[email protected]/Thanks. Yes, that bug is unfortunate. I'm hoping Christian will take that patch in soon so all of the tests will pass.
Quoted 8 lines
So maybe we can mark that:
_fixed_by_kernel_commitxxxxxxxxxxxx ...or
_wants_kernel_commitxxxxxxxxxxxx ...
Quoted 7 lines
Quoted 4 lines
Anyway, we can add that after the patchset get merged. I'll merge this patchset at first.
Reviewed-by Zorro Lang <[email protected]>If you like. This functionality is only in v6.19-rc so far, so there is no released kernel that has this (yet).
Hi Jeff/Zorro,
Having rebased on 6.19-rc1, I now see that generic/787 (this test) fails with:
--- /run/fstests/bin/tests/generic/787.out 2025-12-09 09:18:49.076881595 -0800
+++ /var/tmp/fstests/generic/787.out.bad 2025-12-16 07:23:40.092000000 -0800
@@ -1,2 +1,4 @@
QA output created by 787
-success!
+ls: cannot access '/mnt/dirdeleg': No such file or directory +Server reported failure (2)
+(see /var/tmp/fstests/generic/787.full for details)
The 787.full file contains:
***** Client log *****
10 tests run, 0 failed
***** Server log *****
***** Server failure *****
in test 3, while Set Delegationing using offset 1, length 0 - err = 0:Success
3:Fail Write Deleg if file is open somewhere else
***** Server failure *****
in test 3, while Get Delegationing using offset 1, length 0 - err = 0:Success
3:Fail Write Deleg if file is open somewhere else
***** Server failure *****
in test 4, while Set Delegationing using offset 0, length 0 - err = 0:Success
4:Fail Read Deleg if opened with write permissions
***** Server failure *****
in test 4, while Get Delegationing using offset 0, length 0 - err = 0:Success
4:Fail Read Deleg if opened with write permissions
13 tests run, 2 failed
***** End file details *****Server reported failure (2)
(Apparently this test would _notrun in 6.18-rc)
Is this the failure fixed by the patch above? If so, I'll ignore the failure until rc2.
--D
Quoted 2 lines
Jeff Layton <[email protected]>
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 66 lines · Darrick J. Wong
Quoted 24 lines · Jeff Layton
Quoted 10 lines · Zorro Lang
Quoted 5 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>---
This version is good to me. But this test fails without the:
https://lore.kernel.org/linux-fsdevel/[email protected]/Thanks. Yes, that bug is unfortunate. I'm hoping Christian will take that patch in soon so all of the tests will pass.
Quoted 8 lines
So maybe we can mark that:
_fixed_by_kernel_commitxxxxxxxxxxxx ...or
_wants_kernel_commitxxxxxxxxxxxx ...Quoted 7 lines
Quoted 4 lines
Anyway, we can add that after the patchset get merged. I'll merge this patchset at first.
Reviewed-by Zorro Lang <[email protected]>If you like. This functionality is only in v6.19-rc so far, so there is no released kernel that has this (yet).
Hi Jeff/Zorro,
Having rebased on 6.19-rc1, I now see that generic/787 (this test) fails with:
---
/run/fstests/bin/tests/generic/787.out2025-12-09 09:18:49.076881595 -0800
+++/var/tmp/fstests/generic/787.out.bad2025-12-16 07:23:40.092000000 -0800
@@ -1,2 +1,4 @@
QA output created by 787
-success!
+ls: cannot access '/mnt/dirdeleg': No such file or directory +Server reported failure (2)
+(see/var/tmp/fstests/generic/787.fullfor details)The 787.full file contains:
***** Client log ***** 10 tests run, 0 failed ***** Server log ***** ***** Server failure ***** in test 3, while Set Delegationing using offset 1, length 0 - err = 0:Success 3:Fail Write Deleg if file is open somewhere else ***** Server failure ***** in test 3, while Get Delegationing using offset 1, length 0 - err = 0:Success 3:Fail Write Deleg if file is open somewhere else ***** Server failure ***** in test 4, while Set Delegationing using offset 0, length 0 - err = 0:Success 4:Fail Read Deleg if opened with write permissions ***** Server failure ***** in test 4, while Get Delegationing using offset 0, length 0 - err = 0:Success 4:Fail Read Deleg if opened with write permissions 13 tests run, 2 failed ***** End file details *****
Quoted 6 lines
Server reported failure (2)
(Apparently this test would
_notrunin 6.18-rc)Is this the failure fixed by the patch above? If so, I'll ignore the failure until rc2.
Yep, the patch should fix that. Christian just merged the fix into his tree, so I'm hoping it'll make the -rc3 or 4.
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 69 lines · Jeff Layton
Quoted 68 lines · Darrick J. Wong
Quoted 24 lines · Jeff Layton
Quoted 10 lines · Zorro Lang
Quoted 5 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>---
This version is good to me. But this test fails without the:
https://lore.kernel.org/linux-fsdevel/[email protected]/Thanks. Yes, that bug is unfortunate. I'm hoping Christian will take that patch in soon so all of the tests will pass.
Quoted 8 lines
So maybe we can mark that:
_fixed_by_kernel_commitxxxxxxxxxxxx ...or
_wants_kernel_commitxxxxxxxxxxxx ...Quoted 7 lines
Quoted 4 lines
Anyway, we can add that after the patchset get merged. I'll merge this patchset at first.
Reviewed-by Zorro Lang <[email protected]>If you like. This functionality is only in v6.19-rc so far, so there is no released kernel that has this (yet).
Hi Jeff/Zorro,
Having rebased on 6.19-rc1, I now see that generic/787 (this test) fails with:
---
/run/fstests/bin/tests/generic/787.out2025-12-09 09:18:49.076881595 -0800
+++/var/tmp/fstests/generic/787.out.bad2025-12-16 07:23:40.092000000 -0800
@@ -1,2 +1,4 @@
QA output created by 787
-success!
+ls: cannot access '/mnt/dirdeleg': No such file or directory +Server reported failure (2)
+(see/var/tmp/fstests/generic/787.fullfor details)The 787.full file contains:
***** Client log ***** 10 tests run, 0 failed ***** Server log ***** ***** Server failure ***** in test 3, while Set Delegationing using offset 1, length 0 - err = 0:Success 3:Fail Write Deleg if file is open somewhere else ***** Server failure ***** in test 3, while Get Delegationing using offset 1, length 0 - err = 0:Success 3:Fail Write Deleg if file is open somewhere else ***** Server failure ***** in test 4, while Set Delegationing using offset 0, length 0 - err = 0:Success 4:Fail Read Deleg if opened with write permissions ***** Server failure ***** in test 4, while Get Delegationing using offset 0, length 0 - err = 0:Success 4:Fail Read Deleg if opened with write permissions 13 tests run, 2 failed ***** End file details *****Server reported failure (2)
Quoted 7 lines
Quoted 4 lines
(Apparently this test would
_notrunin 6.18-rc)Is this the failure fixed by the patch above? If so, I'll ignore the failure until rc2.
Yep, the patch should fix that. Christian just merged the fix into his tree, so I'm hoping it'll make the -rc3 or 4.
Ok, thanks for letting me know. :)
--D
Quoted 4 lines
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
In reply to Jeff LaytonQuoted 2 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Under what conditions is this test supposed to actually work? It seems to consistently fail for me even with latest mainline, which is a bit annoying.
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Under what conditions is this test supposed to actually work? It seems to consistently fail for me even with latest mainline, which is a bit annoying.
There is a patch that is not yet merged:
https://lore.kernel.org/linux-fsdevel/[email protected]/
Christian, do you plan to send this to Linus for v6.19? I think we need it.
Thanks,
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 10 lines · Jeff Layton
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Under what conditions is this test supposed to actually work? It seems to consistently fail for me even with latest mainline, which is a bit annoying.
There is a patch that is not yet merged:
Thanks. Also what is the story with generic/786 on NFS?
It seems to constantly fail for me:
generic/786 5s ... [ 17.862569] run fstests generic/786 at 2026-01-07 05:29:40
[failed, exit status 1]- output mismatch (see /root/xfstests-dev/results//generic/786.out.bad)
--- tests/generic/786.out 2025-12-18 06:25:33.420000000 +0000
+++ /root/xfstests-dev/results//generic/786.out.bad 2026-01-07 05:29:47.576897353 +0000
@@ -1,2 +1,3 @@
QA output created by 786
-success!
+Server reported failure (1)
+(see /root/xfstests-dev/results//generic/786.full for details)
...
(Run 'diff -u /root/xfstests-dev/tests/generic/786.out /root/xfstests-dev/results//generic/786.out.bad' to see the entire diff)
Re: [PATCH fstests v3 3/3] generic: add tests for file delegations
Quoted 16 lines · Christoph Hellwig
Quoted 10 lines · Jeff Layton
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Under what conditions is this test supposed to actually work? It seems to consistently fail for me even with latest mainline, which is a bit annoying.
There is a patch that is not yet merged:
Thanks. Also what is the story with generic/786 on NFS?
It seems to constantly fail for me:
Quoted 11 lines
generic/786 5s ... [ 17.862569] run fstests generic/786 at 2026-01-07 05:29:40
[failed, exit status 1]- output mismatch (see/root/xfstests-dev/results//generic/786.out.bad)
--- tests/generic/786.out 2025-12-18 06:25:33.420000000 +0000
+++/root/xfstests-dev/results//generic/786.out.bad2026-01-07 05:29:47.576897353 +0000
@@ -1,2 +1,3 @@
QA output created by 786
-success!
+Server reported failure (1)
+(see/root/xfstests-dev/results//generic/786.fullfor details)
...
(Run 'diff -u/root/xfstests-dev/tests/generic/786.out/root/xfstests-dev/results//generic/786.out.bad' to see the entire diff)
Mea culpa.
I missed the fact that directories have a different set of file_operations on NFS here, and those don't have the ->setlease method set. It's a simple fix, but it looks like I'll need to do this in some other filesystems too. I'll send a follow-on series soon.
Thanks,
Signature · 1 line
Jeff Layton <[email protected]>