From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com ([141.146.126.79]:52356 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbfBMEdr (ORCPT ); Tue, 12 Feb 2019 23:33:47 -0500 Date: Tue, 12 Feb 2019 20:33:41 -0800 From: "Darrick J. Wong" Subject: Re: [PATCH 2/2] generic: check the behavior of programs opening a lot of O_TMPFILE files Message-ID: <20190213043341.GA32253@magnolia> References: <154993786231.2062.8490515215533507881.stgit@magnolia> <154993787478.2062.17047634303195751186.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Amir Goldstein Cc: Eryu Guan , linux-xfs , fstests On Tue, Feb 12, 2019 at 04:42:21AM +0200, Amir Goldstein wrote: > On Tue, Feb 12, 2019 at 4:18 AM Darrick J. Wong wrote: > > > > From: Darrick J. Wong > > > > 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 > > --- > > 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. Will fix. > ... > > +/* 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? Nope, just sillyness on my part. Thanks for the suggestion. --D > Thanks, > Amir.