Re: [PATCH 2/2] generic: check the behavior of programs opening a lot of O_TMPFILE files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 12, 2019 at 4:18 AM Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote:
>
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
>
> Create a test (+ helper program) that opens as many unlinked files as it
> possibly can on the scratch filesystem, then closes all the files at
> once to stress-test unlinked file cleanup.  Add an xfs-specific test to
> make sure that the fallback code doesn't bitrot.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  src/Makefile          |    2 -
>  src/tmpfile.c         |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/710     |   65 +++++++++++++++++++++++++
>  tests/generic/710.out |    2 +
>  tests/generic/711     |   73 ++++++++++++++++++++++++++++
>  tests/generic/711.out |    2 +
>  tests/generic/group   |    2 +
>  tests/xfs/736         |   71 +++++++++++++++++++++++++++
>  tests/xfs/736.out     |    2 +
>  tests/xfs/737         |   79 ++++++++++++++++++++++++++++++
>  tests/xfs/737.out     |    2 +
>  tests/xfs/group       |    2 +
>  12 files changed, 428 insertions(+), 1 deletion(-)
>  create mode 100644 src/tmpfile.c
>  create mode 100755 tests/generic/710
>  create mode 100644 tests/generic/710.out
>  create mode 100755 tests/generic/711
>  create mode 100644 tests/generic/711.out
>  create mode 100755 tests/xfs/736
>  create mode 100644 tests/xfs/736.out
>  create mode 100755 tests/xfs/737
>  create mode 100644 tests/xfs/737.out
>
>
> diff --git a/src/Makefile b/src/Makefile
> index 41826585..5fce881d 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -27,7 +27,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
>         renameat2 t_getcwd e4compact test-nextquota punch-alternating \
>         attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \
>         dio-invalidate-cache stat_test t_encrypted_d_revalidate \
> -       attr_replace_test swapon mkswap
> +       attr_replace_test swapon mkswap tmpfile
>
>  SUBDIRS = log-writes perf
>
> diff --git a/src/tmpfile.c b/src/tmpfile.c

Let's go crazy and call it t_open_tmpfiles ?
Missing .gitignore patch.

...
> +/* Put an opened file on the unlinked list and leak the fd. */
> +void leak_tmpfile(void)
> +{
> +       int fd = -1;
> +       int ret;
> +
> +       /* Try to create an O_TMPFILE and leak the fd. */
> +#ifdef O_TMPFILE
> +       fd = open(".", O_TMPFILE | O_RDWR, 0644);

Pass in path as argv[1], so you won't need to cd $SCRATCH_MNT
all the time. Or does it have a purpose?

Thanks,
Amir.



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux