From 4774d1fab1ba701900aae61ae40987e64af7a635 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 17 Aug 2023 16:06:36 -0600 Subject: [PATCH] LU-17038 tests: remove munlink utility The munlink utility is obsoleted by the unlink command added in the coreutils package many moons ago, and can be removed. All tests using munlink are replaced with unlink. Test-Parameters: trivial testlist=recovery-small,replay-dual,replay-single Signed-off-by: Andreas Dilger Change-Id: I984406525ed958814bd8af74a2d81c4920e320b0 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51977 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Timothy Day Reviewed-by: Arshad Hussain Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- debian/lustre-tests.install | 1 - debian/rules | 1 - lustre.spec.in | 1 - lustre/tests/.gitignore | 1 - lustre/tests/Makefile.am | 2 +- lustre/tests/munlink.c | 61 ------------------------------------------ lustre/tests/recovery-small.sh | 33 ++++++++--------------- lustre/tests/replay-dual.sh | 2 +- lustre/tests/replay-single.sh | 8 +++--- lustre/tests/sanity.sh | 7 +++-- 10 files changed, 20 insertions(+), 97 deletions(-) delete mode 100644 lustre/tests/munlink.c diff --git a/debian/lustre-tests.install b/debian/lustre-tests.install index 5972ff0..e90eafe 100644 --- a/debian/lustre-tests.install +++ b/debian/lustre-tests.install @@ -1,5 +1,4 @@ debian/tmp/usr/lib/lustre/tests/* usr/lib/lustre/tests debian/tmp/usr/bin/mcreate usr/bin -debian/tmp/usr/bin/munlink usr/bin debian/tmp/usr/bin/statx usr/bin debian/tmp/usr/sbin/wire* usr/sbin diff --git a/debian/rules b/debian/rules index d0cd233..87edcda 100755 --- a/debian/rules +++ b/debian/rules @@ -262,7 +262,6 @@ binary-$(UTILS_PKG): build-stamp rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \ debian/$(UTILS_PKG)/usr/bin/*-survey \ debian/$(UTILS_PKG)/usr/bin/mcreate \ - debian/$(UTILS_PKG)/usr/bin/munlink \ debian/$(UTILS_PKG)/usr/bin/statx \ debian/$(UTILS_PKG)/usr/sbin/wirecheck \ debian/$(UTILS_PKG)/usr/sbin/wiretest diff --git a/lustre.spec.in b/lustre.spec.in index a4d1121..f6e11d3 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -748,7 +748,6 @@ echo '%dir %{_libdir}/lustre' >>lustre-tests.files echo '%dir %{_libdir}/lustre/tests' >>lustre-tests.files echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files echo '%{_bindir}/mcreate' >>lustre-tests.files -echo '%{_bindir}/munlink' >>lustre-tests.files echo '%{_bindir}/statx' >>lustre-tests.files echo '%{_sbindir}/wirecheck' >>lustre-tests.files echo '%{_sbindir}/wiretest' >>lustre-tests.files diff --git a/lustre/tests/.gitignore b/lustre/tests/.gitignore index cc7d016..49ad395 100644 --- a/lustre/tests/.gitignore +++ b/lustre/tests/.gitignore @@ -59,7 +59,6 @@ /mrename /multifstat /multiop -/munlink /newfile /o_directory /open_delay diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index e99b9f2..5a62b92 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -95,7 +95,7 @@ if BUILD_LUTF SUBDIRS += lutf endif # BUILD_LUTF -bin_PROGRAMS = mcreate munlink statx +bin_PROGRAMS = mcreate statx testdir = $(libdir)/lustre/tests test_SCRIPTS = $(noinst_SCRIPTS) test_PROGRAMS = $(THETESTS) diff --git a/lustre/tests/munlink.c b/lustre/tests/munlink.c deleted file mode 100644 index 0b8e253..0000000 --- a/lustre/tests/munlink.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.gnu.org/licenses/gpl-2.0.html - * - * GPL HEADER END - */ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - */ - -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - int rc = 0, i; - - if (argc < 2) { - printf("Usage %s filename {filename ...}\n", argv[0]); - return 1; - } - - for (i = 1; i < argc; i++) { - rc = unlink(argv[i]); - if (rc) { - printf("unlink(%s): %s ", argv[i], strerror(errno)); - rc = access(argv[i], F_OK); - if (rc && errno == ENOENT) - printf("(unlinked anyways)\n"); - else if (rc == 0) - printf("(still exists)\n"); - else - printf("(%s looking up)\n", strerror(errno)); - } - } - return rc; -} diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 81ff00c..775f9c0 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -89,23 +89,12 @@ test_6() { local LINK1=$DIR/$tfile.link1 local LINK2=$DIR/$tfile.link2 - do_facet_create_file client $T 10K || - error_noexit "Create file $T" - - drop_request "mlink $T $LINK1" || - error_noexit "mlink request for $T" - - drop_reint_reply "mlink $T $LINK2" || - error_noexit "mlink reply for $T" - - drop_request "munlink $LINK1" || - error_noexit "munlink request for $T" - - drop_reint_reply "munlink $LINK2" || - error_noexit "munlink reply for $T" - - do_facet client "rm $T" || - error_noexit "Can't remove file $T" + do_facet_create_file client $T 10K || error_noexit "Create file $T" + drop_request "mlink $T $LINK1" || error_noexit "mlink request for $T" + drop_reint_reply "mlink $T $LINK2" || error_noexit "mlink reply for $T" + drop_request "unlink $LINK1" || error_noexit "unlink request for $T" + drop_reint_reply "unlink $LINK2" || error_noexit "unlink reply for $T" + do_facet client "rm $T" || error_noexit "Can't remove file $T" } run_test 6 "link, unlink: drop req, drop rep" @@ -331,8 +320,8 @@ test_11(){ drop_bl_callback_once $MULTIOP $DIR/$tfile Ow || echo "evicted as expected" - do_facet client munlink $DIR/$tfile || - { error "munlink failed: $?"; return 4; } + do_facet client unlink $DIR/$tfile || + { error "unlink failed: $?"; return 4; } # allow recovery to complete client_up || client_up || sleep $TIMEOUT } @@ -350,8 +339,8 @@ test_12(){ kill -USR1 $PID echo "waiting for multiop $PID" wait $PID || { error "wait for multiop faile: $?"; return 2; } - do_facet client munlink $DIR/$tfile || - { error "client munlink failed: $?"; return 3; } + do_facet client unlink $DIR/$tfile || + { error "client unlink failed: $?"; return 3; } # allow recovery to complete client_up || client_up || sleep $TIMEOUT } @@ -692,7 +681,7 @@ test_19b() { error "failed to ldlm_cancel: $?" umount_client $DIR2 || error "failed to unmount $DIR2: $?" - do_facet client munlink $DIR/$tfile || + do_facet client unlink $DIR/$tfile || error "failed to unlink $DIR/$tfile: $?" # let the client reconnect diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index 9043d62..693a299 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -233,7 +233,7 @@ run_test 9 "resending a replayed create" test_10() { mcreate $MOUNT1/$tfile-1 replay_barrier $SINGLEMDS - munlink $MOUNT1/$tfile-1 + unlink $MOUNT1/$tfile-1 mcreate $MOUNT2/$tfile-2 # drop first reint reply do_facet $SINGLEMDS lctl set_param fail_loc=0x80000119 diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 69a478b..57013f1 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -398,12 +398,12 @@ run_test 15 "open(O_CREAT), unlink |X| touch new, close" test_16() { replay_barrier $SINGLEMDS mcreate $DIR/$tfile - munlink $DIR/$tfile + unlink $DIR/$tfile mcreate $DIR/$tfile-2 fail $SINGLEMDS [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist" [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist" - munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed" + unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed" } run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new" @@ -437,8 +437,8 @@ test_18() { [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist" # this touch frequently fails touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed" - munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed" - munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed" + unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed" + unlink $DIR/$tfile-3 || error "unlink $DIR/$tfile-3 failed" return 0 } run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 8892d80..9370b9c 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -19,7 +19,6 @@ LVERIFY=${LVERIFY:-ll_dirstripe_verify} OPENFILE=${OPENFILE:-openfile} OPENUNLINK=${OPENUNLINK:-openunlink} READS=${READS:-"reads"} -MUNLINK=${MUNLINK:-munlink} SOCKETSERVER=${SOCKETSERVER:-socketserver} SOCKETCLIENT=${SOCKETCLIENT:-socketclient} MEMHOG=${MEMHOG:-memhog} @@ -3797,7 +3796,7 @@ link_one() { local tempfile=$(mktemp $1_XXXXXX) mlink $tempfile $1 2> /dev/null && echo "$BASHPID: link $tempfile to $1 succeeded" - munlink $tempfile + unlink $tempfile } test_31o() { # LU-2901 @@ -5441,7 +5440,7 @@ test_42b() { sync dd if=/dev/zero of=$DIR/f42b bs=1024 count=100 BEFOREWRITES=$(count_ost_writes) - $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?" + unlink $DIR/f42b || error "unlink $DIR/f42b: $?" AFTERWRITES=$(count_ost_writes) if [[ $BEFOREWRITES -lt $AFTERWRITES ]]; then error "$BEFOREWRITES < $AFTERWRITES on unlink" @@ -6256,7 +6255,7 @@ test_54a() { error "$SOCKETSERVER $DIR/socket failed: $?" LANG=C $SOCKETCLIENT $DIR/socket || error "$SOCKETCLIENT $DIR/socket failed: $?" - $MUNLINK $DIR/socket || error "$MUNLINK $DIR/socket failed: $?" + unlink $DIR/socket || error "unlink $DIR/socket failed: $?" } run_test 54a "unix domain socket test ==========================" -- 1.8.3.1