Skip to content

Commit 9f1f384

Browse files
committed
Merge branch 'master' of zfs into 12008-sparc64
Signed-off-by: Rich Ercolani <[email protected]>
2 parents fe50946 + 8670644 commit 9f1f384

File tree

155 files changed

+10094
-6532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+10094
-6532
lines changed

.github/workflows/zfs-tests-functional.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
2727
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
2828
libpam0g-dev pamtester python-dev python-setuptools python-cffi \
29-
python3 python3-dev python3-setuptools python3-cffi
29+
python3 python3-dev python3-setuptools python3-cffi libcurl4-openssl-dev
3030
- name: Autogen.sh
3131
run: |
3232
sh autogen.sh

.github/workflows/zfs-tests-sanity.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
2323
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
2424
libpam0g-dev pamtester python-dev python-setuptools python-cffi \
25-
python3 python3-dev python3-setuptools python3-cffi
25+
python3 python3-dev python3-setuptools python3-cffi libcurl4-openssl-dev
2626
- name: Autogen.sh
2727
run: |
2828
sh autogen.sh

Makefile.am

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SUBDIRS += rpm
66
endif
77

88
if CONFIG_USER
9-
SUBDIRS += etc man scripts lib tests cmd contrib
9+
SUBDIRS += man scripts lib tests cmd etc contrib
1010
if BUILD_LINUX
1111
SUBDIRS += udev
1212
endif
@@ -126,9 +126,9 @@ filter_executable = -exec test -x '{}' \; -print
126126
PHONY += shellcheck
127127
shellcheck:
128128
@if type shellcheck > /dev/null 2>&1; then \
129-
shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
130-
$$(find ${top_srcdir}/scripts/*.sh -type f) \
131-
$$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
129+
shellcheck --exclude=SC1090,SC1117,SC1091 --format=gcc \
130+
$$(find ${top_srcdir} -name "config*" -prune -name tests -prune \
131+
-o -name "*.sh" -o -name "*.sh.in" -type f) \
132132
$$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
133133
-type f ${filter_executable}); \
134134
else \
@@ -159,20 +159,19 @@ checkbashisms:
159159
-o -name 'paxcheck.sh' -prune \
160160
-o -name 'make_gitrev.sh' -prune \
161161
-o -name '90zfs' -prune \
162+
-o -path '*initramfs/hooks' -prune \
162163
-o -type f ! -name 'config*' \
163164
! -name 'libtool' \
164-
-exec sh -c 'awk "NR==1 && /#!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
165+
-exec awk 'FNR==1 && /^#!.*bin\/sh/ {print FILENAME}' {} \+); \
165166
else \
166167
echo "skipping checkbashisms because checkbashisms is not installed"; \
167168
fi
168169

169170
PHONY += mancheck
170171
mancheck:
171172
@if type mandoc > /dev/null 2>&1; then \
172-
find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
173-
-o -name 'zpool.8' -o -name 'zdb.8' \
174-
-o -name 'zgenhostid.8' | \
175-
xargs mandoc -Tlint -Werror; \
173+
find ${top_srcdir}/man/man8 -type f -name '*[1-9]*' \
174+
-exec mandoc -Tlint -Werror {} \+; \
176175
else \
177176
echo "skipping mancheck because mandoc is not installed"; \
178177
fi

cmd/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS = zfs zpool zdb zhack zinject zstream zstreamdump ztest
1+
SUBDIRS = zfs zpool zdb zhack zinject zstream ztest
22
SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path
33
SUBDIRS += zpool_influxdb
44

cmd/arc_summary/arc_summary2

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,6 @@ show_tunable_descriptions = False
102102
alternate_tunable_layout = False
103103

104104

105-
def handle_Exception(ex_cls, ex, tb):
106-
if ex is IOError:
107-
if ex.errno == errno.EPIPE:
108-
sys.exit()
109-
110-
if ex is KeyboardInterrupt:
111-
sys.exit()
112-
113-
114-
sys.excepthook = handle_Exception
115-
116-
117105
def get_Kstat():
118106
"""Collect information on the ZFS subsystem from the /proc virtual
119107
file system. The name "kstat" is a holdover from the Solaris utility
@@ -1137,48 +1125,55 @@ def main():
11371125
global alternate_tunable_layout
11381126

11391127
try:
1140-
opts, args = getopt.getopt(
1141-
sys.argv[1:],
1142-
"adp:h", ["alternate", "description", "page=", "help"]
1143-
)
1144-
except getopt.error as e:
1145-
sys.stderr.write("Error: %s\n" % e.msg)
1146-
usage()
1147-
sys.exit(1)
1148-
1149-
args = {}
1150-
for opt, arg in opts:
1151-
if opt in ('-a', '--alternate'):
1152-
args['a'] = True
1153-
if opt in ('-d', '--description'):
1154-
args['d'] = True
1155-
if opt in ('-p', '--page'):
1156-
args['p'] = arg
1157-
if opt in ('-h', '--help'):
1158-
usage()
1159-
sys.exit(0)
1160-
1161-
Kstat = get_Kstat()
1162-
1163-
alternate_tunable_layout = 'a' in args
1164-
show_tunable_descriptions = 'd' in args
1165-
1166-
pages = []
1167-
1168-
if 'p' in args:
11691128
try:
1170-
pages.append(unSub[int(args['p']) - 1])
1171-
except IndexError:
1172-
sys.stderr.write('the argument to -p must be between 1 and ' +
1173-
str(len(unSub)) + '\n')
1129+
opts, args = getopt.getopt(
1130+
sys.argv[1:],
1131+
"adp:h", ["alternate", "description", "page=", "help"]
1132+
)
1133+
except getopt.error as e:
1134+
sys.stderr.write("Error: %s\n" % e.msg)
1135+
usage()
11741136
sys.exit(1)
1175-
else:
1176-
pages = unSub
11771137

1178-
zfs_header()
1179-
for page in pages:
1180-
page(Kstat)
1181-
sys.stdout.write("\n")
1138+
args = {}
1139+
for opt, arg in opts:
1140+
if opt in ('-a', '--alternate'):
1141+
args['a'] = True
1142+
if opt in ('-d', '--description'):
1143+
args['d'] = True
1144+
if opt in ('-p', '--page'):
1145+
args['p'] = arg
1146+
if opt in ('-h', '--help'):
1147+
usage()
1148+
sys.exit(0)
1149+
1150+
Kstat = get_Kstat()
1151+
1152+
alternate_tunable_layout = 'a' in args
1153+
show_tunable_descriptions = 'd' in args
1154+
1155+
pages = []
1156+
1157+
if 'p' in args:
1158+
try:
1159+
pages.append(unSub[int(args['p']) - 1])
1160+
except IndexError:
1161+
sys.stderr.write('the argument to -p must be between 1 and ' +
1162+
str(len(unSub)) + '\n')
1163+
sys.exit(1)
1164+
else:
1165+
pages = unSub
1166+
1167+
zfs_header()
1168+
for page in pages:
1169+
page(Kstat)
1170+
sys.stdout.write("\n")
1171+
except IOError as ex:
1172+
if (ex.errno == errno.EPIPE):
1173+
sys.exit(0)
1174+
raise
1175+
except KeyboardInterrupt:
1176+
sys.exit(0)
11821177

11831178

11841179
if __name__ == '__main__':

cmd/arc_summary/arc_summary3

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ import subprocess
4343
import sys
4444
import time
4545

46+
# We can't use env -S portably, and we need python3 -u to handle pipes in
47+
# the shell abruptly closing the way we want to, so...
48+
import io
49+
if isinstance(sys.__stderr__.buffer, io.BufferedWriter):
50+
os.execv(sys.executable, [sys.executable, "-u"] + sys.argv)
51+
4652
DESCRIPTION = 'Print ARC and other statistics for OpenZFS'
4753
INDENT = ' '*8
4854
LINE_LENGTH = 72
@@ -221,6 +227,24 @@ elif sys.platform.startswith('linux'):
221227

222228
return descs
223229

230+
def handle_unraisableException(exc_type, exc_value=None, exc_traceback=None,
231+
err_msg=None, object=None):
232+
handle_Exception(exc_type, object, exc_traceback)
233+
234+
def handle_Exception(ex_cls, ex, tb):
235+
if ex_cls is KeyboardInterrupt:
236+
sys.exit()
237+
238+
if ex_cls is BrokenPipeError:
239+
# It turns out that while sys.exit() triggers an exception
240+
# not handled message on Python 3.8+, os._exit() does not.
241+
os._exit(0)
242+
raise ex
243+
244+
if hasattr(sys,'unraisablehook'): # Python 3.8+
245+
sys.unraisablehook = handle_unraisableException
246+
sys.excepthook = handle_Exception
247+
224248

225249
def cleanup_line(single_line):
226250
"""Format a raw line of data from /proc and isolate the name value

cmd/fsck_zfs/fsck.zfs.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ for dataset in "$@"; do
2626

2727
case "$(@sbindir@/zpool list -Ho health "$pool")" in
2828
DEGRADED)
29-
ret=$(( $ret | 4 ))
29+
ret=$(( ret | 4 ))
3030
;;
3131
FAULTED)
3232
awk '!/^([[:space:]]*#.*)?$/ && $1 == "'"$dataset"'" && $3 == "zfs" {exit 1}' /etc/fstab || \
33-
ret=$(( $ret | 8 ))
33+
ret=$(( ret | 8 ))
3434
;;
3535
"")
3636
# Pool not found, error printed by zpool(8)
37-
ret=$(( $ret | 8 ))
37+
ret=$(( ret | 8 ))
3838
;;
3939
*)
4040
;;

cmd/mount_zfs/mount_zfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ main(int argc, char **argv)
185185
break;
186186
case 'h':
187187
case '?':
188-
(void) fprintf(stderr, gettext("Invalid option '%c'\n"),
189-
optopt);
188+
if (optopt)
189+
(void) fprintf(stderr,
190+
gettext("Invalid option '%c'\n"), optopt);
190191
(void) fprintf(stderr, gettext("Usage: mount.zfs "
191-
"[-sfnv] [-o options] <dataset> <mountpoint>\n"));
192+
"[-sfnvh] [-o options] <dataset> <mountpoint>\n"));
192193
return (MOUNT_USAGE);
193194
}
194195
}

cmd/raidz_test/raidz_test.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
static int *rand_data;
3838
raidz_test_opts_t rto_opts;
3939

40-
static char gdb[256];
41-
static const char gdb_tmpl[] = "gdb -ex \"set pagination 0\" -p %d";
40+
static char pid_s[16];
4241

4342
static void sig_handler(int signo)
4443
{
44+
int old_errno = errno;
4545
struct sigaction action;
4646
/*
4747
* Restore default action and re-raise signal so SIGSEGV and
@@ -52,10 +52,19 @@ static void sig_handler(int signo)
5252
action.sa_flags = 0;
5353
(void) sigaction(signo, &action, NULL);
5454

55-
if (rto_opts.rto_gdb)
56-
if (system(gdb)) { }
55+
if (rto_opts.rto_gdb) {
56+
pid_t pid = fork();
57+
if (pid == 0) {
58+
execlp("gdb", "gdb", "-ex", "set pagination 0",
59+
"-p", pid_s, NULL);
60+
_exit(-1);
61+
} else if (pid > 0)
62+
while (waitpid(pid, NULL, 0) == -1 && errno == EINTR)
63+
;
64+
}
5765

5866
raise(signo);
67+
errno = old_errno;
5968
}
6069

6170
static void print_opts(raidz_test_opts_t *opts, boolean_t force)
@@ -978,8 +987,8 @@ main(int argc, char **argv)
978987
struct sigaction action;
979988
int err = 0;
980989

981-
/* init gdb string early */
982-
(void) sprintf(gdb, gdb_tmpl, getpid());
990+
/* init gdb pid string early */
991+
(void) sprintf(pid_s, "%d", getpid());
983992

984993
action.sa_handler = sig_handler;
985994
sigemptyset(&action.sa_mask);

0 commit comments

Comments
 (0)