All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4
@ 2018-02-02 21:36 Darrick J. Wong
  2018-02-02 21:36 ` [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled Darrick J. Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-02 21:36 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

Hi all,

Four more fixes -- disallow creation of reflink+realtime filesystems, two
things in scrub that coverity complained about, and an addition to scrub so
that it always logs whatever it finds in syslog, even if running
interactively.

The first three are very straightforward, but Eric wanted more comment on the
syslog thing, so if you have an opinion about how hard we try to record all of
scrub's comments to syslog for later QA retrieval, bikeshed now. :)

--D

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled
  2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
@ 2018-02-02 21:36 ` Darrick J. Wong
  2018-02-02 21:38   ` Eric Sandeen
  2018-02-02 21:36 ` [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer Darrick J. Wong
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-02 21:36 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

We don't support reflink on the realtime device, so don't let people
create such things.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 mkfs/xfs_mkfs.c |    7 +++++++
 1 file changed, 7 insertions(+)


diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 219b209..b20e3d6 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2025,6 +2025,13 @@ _("cowextsize not supported without reflink support\n"));
 		usage();
 	}
 
+	if (cli->sb_feat.reflink && cli->xi->rtname) {
+		fprintf(stderr,
+_("reflink not supported with realtime devices\n"));
+		usage();
+		cli->sb_feat.reflink = false;
+	}
+
 	if (cli->sb_feat.rmapbt && cli->xi->rtname) {
 		fprintf(stderr,
 _("rmapbt not supported with realtime devices\n"));


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer
  2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
  2018-02-02 21:36 ` [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled Darrick J. Wong
@ 2018-02-02 21:36 ` Darrick J. Wong
  2018-02-02 21:39   ` Eric Sandeen
  2018-02-02 21:36 ` [PATCH 3/4] xfs_scrub: kill dead code Darrick J. Wong
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-02 21:36 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

If we don't get a directory pointer, close dir_fd before jumping out.

Fixes-coverity-id: 1428799
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/vfs.c |    2 ++
 1 file changed, 2 insertions(+)


diff --git a/scrub/vfs.c b/scrub/vfs.c
index e3c8e62..573a2d0 100644
--- a/scrub/vfs.c
+++ b/scrub/vfs.c
@@ -88,6 +88,7 @@ scan_fs_dir(
 	/* Caller-specific directory checks. */
 	if (!sft->dir_fn(ctx, sftd->path, dir_fd, sft->arg)) {
 		sft->moveon = false;
+		close(dir_fd);
 		goto out;
 	}
 
@@ -95,6 +96,7 @@ scan_fs_dir(
 	dir = fdopendir(dir_fd);
 	if (!dir) {
 		str_errno(ctx, sftd->path);
+		close(dir_fd);
 		goto out;
 	}
 	rewinddir(dir);


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] xfs_scrub: kill dead code
  2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
  2018-02-02 21:36 ` [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled Darrick J. Wong
  2018-02-02 21:36 ` [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer Darrick J. Wong
@ 2018-02-02 21:36 ` Darrick J. Wong
  2018-02-02 21:46   ` Eric Sandeen
  2018-02-02 21:36 ` [PATCH 4/4] xfs_scrub: log operational messages when interactive Darrick J. Wong
  2018-02-05 16:50 ` [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision Darrick J. Wong
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-02 21:36 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

We can't reach the return mess at the bottom of __xfs_scrub_test so get
rid of it.

Fixes-coverity-id: 1428798
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/scrub.c |    1 -
 1 file changed, 1 deletion(-)


diff --git a/scrub/scrub.c b/scrub/scrub.c
index 0dbe11c..6abca2a 100644
--- a/scrub/scrub.c
+++ b/scrub/scrub.c
@@ -602,7 +602,6 @@ _("Kernel %s %s facility not detected."),
 		str_info(ctx, ctx->mntpoint, "%s", strerror(errno));
 		return true;
 	}
-	return error == 0 || (error && errno != EOPNOTSUPP && errno != ENOTTY);
 }
 
 bool


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] xfs_scrub: log operational messages when interactive
  2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
                   ` (2 preceding siblings ...)
  2018-02-02 21:36 ` [PATCH 3/4] xfs_scrub: kill dead code Darrick J. Wong
@ 2018-02-02 21:36 ` Darrick J. Wong
  2018-02-05 16:50 ` [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision Darrick J. Wong
  4 siblings, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-02 21:36 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

Record the output of an interactive session in the system log so that
future support requests can get a better picture of what happened.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/common.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)


diff --git a/scrub/common.c b/scrub/common.c
index 17c3699..0326e34 100644
--- a/scrub/common.c
+++ b/scrub/common.c
@@ -21,6 +21,7 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <sys/statvfs.h>
+#include <syslog.h>
 #include "platform_defs.h"
 #include "xfs.h"
 #include "xfs_fs.h"
@@ -29,6 +30,8 @@
 #include "common.h"
 #include "progress.h"
 
+extern char		*progname;
+
 /*
  * Reporting Status to the Console
  *
@@ -64,6 +67,12 @@ static const char *err_str[] = {
 	[S_PREEN]	= "Optimized",
 };
 
+static int log_level[] = {
+	[S_ERROR]	= LOG_ERR,
+	[S_WARN]	= LOG_WARNING,
+	[S_INFO]	= LOG_INFO,
+};
+
 /* If stream is a tty, clear to end of line to clean up progress bar. */
 static inline const char *stream_start(FILE *stream)
 {
@@ -73,6 +82,8 @@ static inline const char *stream_start(FILE *stream)
 }
 
 /* Print a warning string and some warning text. */
+#define LOG_BUFSZ	4096
+#define LOGNAME_BUFSZ	256
 void
 __str_out(
 	struct scrub_ctx	*ctx,
@@ -110,6 +121,32 @@ __str_out(
 		va_end(args);
 	}
 
+	/* If we're running interactively, log the message to syslog too. */
+	if (isatty(fileno(stdin))) {
+		char	logname[LOGNAME_BUFSZ];
+
+		snprintf(logname, LOGNAME_BUFSZ, "%s@%s", progname,
+				ctx->mntpoint);
+		openlog(logname, LOG_PID, LOG_DAEMON);
+
+		if (error) {
+			syslog(LOG_ERR, "%s: %s: %s.",
+					_(err_str[level]), descr,
+					strerror_r(error, buf, DESCR_BUFSZ));
+		} else {
+			char	buf[LOG_BUFSZ];
+			int	sz;
+
+			sz = snprintf(buf, LOG_BUFSZ, "%s: %s: ",
+					_(err_str[level]), descr);
+			va_start(args, format);
+			vsnprintf(buf + sz, LOG_BUFSZ - sz, format, args);
+			va_end(args);
+			syslog(log_level[level], "%s", buf);
+		}
+		closelog();
+	}
+
 	if (debug)
 		fprintf(stream, _(" (%s line %d)"), file, line);
 	fprintf(stream, "\n");


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled
  2018-02-02 21:36 ` [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled Darrick J. Wong
@ 2018-02-02 21:38   ` Eric Sandeen
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-02-02 21:38 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On 2/2/18 3:36 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> We don't support reflink on the realtime device, so don't let people
> create such things.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  mkfs/xfs_mkfs.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 219b209..b20e3d6 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2025,6 +2025,13 @@ _("cowextsize not supported without reflink support\n"));
>  		usage();
>  	}
>  
> +	if (cli->sb_feat.reflink && cli->xi->rtname) {
> +		fprintf(stderr,
> +_("reflink not supported with realtime devices\n"));
> +		usage();
> +		cli->sb_feat.reflink = false;
> +	}
> +
>  	if (cli->sb_feat.rmapbt && cli->xi->rtname) {
>  		fprintf(stderr,
>  _("rmapbt not supported with realtime devices\n"));
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer
  2018-02-02 21:36 ` [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer Darrick J. Wong
@ 2018-02-02 21:39   ` Eric Sandeen
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-02-02 21:39 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On 2/2/18 3:36 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If we don't get a directory pointer, close dir_fd before jumping out.
> 
> Fixes-coverity-id: 1428799
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/vfs.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> 
> diff --git a/scrub/vfs.c b/scrub/vfs.c
> index e3c8e62..573a2d0 100644
> --- a/scrub/vfs.c
> +++ b/scrub/vfs.c
> @@ -88,6 +88,7 @@ scan_fs_dir(
>  	/* Caller-specific directory checks. */
>  	if (!sft->dir_fn(ctx, sftd->path, dir_fd, sft->arg)) {
>  		sft->moveon = false;
> +		close(dir_fd);
>  		goto out;
>  	}
>  
> @@ -95,6 +96,7 @@ scan_fs_dir(
>  	dir = fdopendir(dir_fd);
>  	if (!dir) {
>  		str_errno(ctx, sftd->path);
> +		close(dir_fd);
>  		goto out;
>  	}
>  	rewinddir(dir);
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] xfs_scrub: kill dead code
  2018-02-02 21:36 ` [PATCH 3/4] xfs_scrub: kill dead code Darrick J. Wong
@ 2018-02-02 21:46   ` Eric Sandeen
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-02-02 21:46 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On 2/2/18 3:36 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> We can't reach the return mess at the bottom of __xfs_scrub_test so get
> rid of it.
> 
> Fixes-coverity-id: 1428798
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/scrub.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> 
> diff --git a/scrub/scrub.c b/scrub/scrub.c
> index 0dbe11c..6abca2a 100644
> --- a/scrub/scrub.c
> +++ b/scrub/scrub.c
> @@ -602,7 +602,6 @@ _("Kernel %s %s facility not detected."),
>  		str_info(ctx, ctx->mntpoint, "%s", strerror(errno));
>  		return true;
>  	}
> -	return error == 0 || (error && errno != EOPNOTSUPP && errno != ENOTTY);
>  }
>  
>  bool
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision
  2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
                   ` (3 preceding siblings ...)
  2018-02-02 21:36 ` [PATCH 4/4] xfs_scrub: log operational messages when interactive Darrick J. Wong
@ 2018-02-05 16:50 ` Darrick J. Wong
  2018-02-05 17:21   ` Eric Sandeen
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-02-05 16:50 UTC (permalink / raw)
  To: sandeen; +Cc: linux-xfs, fredrik

From: Darrick J. Wong <darrick.wong@oracle.com>

glibc 2.27 has a copy_file_range wrapper, so we need to change our
internal function out of the way to avoid compiler warnings.

Reported-by: fredrik@crux.nu
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 io/copy_file_range.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/io/copy_file_range.c b/io/copy_file_range.c
index d1dfc5a..99fba20 100644
--- a/io/copy_file_range.c
+++ b/io/copy_file_range.c
@@ -42,13 +42,18 @@ copy_range_help(void)
 "));
 }
 
+/*
+ * Issue a raw copy_file_range syscall; for our test program we don't want the
+ * glibc buffered copy fallback.
+ */
 static loff_t
-copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
+copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len)
 {
 	loff_t ret;
 
 	do {
-		ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0);
+		ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst,
+				len, 0);
 		if (ret == -1) {
 			perror("copy_range");
 			return errno;
@@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv)
 		copy_dst_truncate();
 	}
 
-	ret = copy_file_range(fd, &src, &dst, len);
+	ret = copy_file_range_cmd(fd, &src, &dst, len);
 	close(fd);
 	return ret;
 }

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision
  2018-02-05 16:50 ` [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision Darrick J. Wong
@ 2018-02-05 17:21   ` Eric Sandeen
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-02-05 17:21 UTC (permalink / raw)
  To: Darrick J. Wong, sandeen; +Cc: linux-xfs, fredrik



On 2/5/18 10:50 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> glibc 2.27 has a copy_file_range wrapper, so we need to change our
> internal function out of the way to avoid compiler warnings.
> 
> Reported-by: fredrik@crux.nu
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Ok, sure.  Yay namespace.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  io/copy_file_range.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/io/copy_file_range.c b/io/copy_file_range.c
> index d1dfc5a..99fba20 100644
> --- a/io/copy_file_range.c
> +++ b/io/copy_file_range.c
> @@ -42,13 +42,18 @@ copy_range_help(void)
>  "));
>  }
>  
> +/*
> + * Issue a raw copy_file_range syscall; for our test program we don't want the
> + * glibc buffered copy fallback.
> + */
>  static loff_t
> -copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
> +copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len)
>  {
>  	loff_t ret;
>  
>  	do {
> -		ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0);
> +		ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst,
> +				len, 0);
>  		if (ret == -1) {
>  			perror("copy_range");
>  			return errno;
> @@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv)
>  		copy_dst_truncate();
>  	}
>  
> -	ret = copy_file_range(fd, &src, &dst, len);
> +	ret = copy_file_range_cmd(fd, &src, &dst, len);
>  	close(fd);
>  	return ret;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-02-05 17:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 21:36 [PATCH 0/4] xfsprogs: 4.15 rollup pt. 4 Darrick J. Wong
2018-02-02 21:36 ` [PATCH 1/4] mkfs: don't create realtime filesystems with reflink enabled Darrick J. Wong
2018-02-02 21:38   ` Eric Sandeen
2018-02-02 21:36 ` [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer Darrick J. Wong
2018-02-02 21:39   ` Eric Sandeen
2018-02-02 21:36 ` [PATCH 3/4] xfs_scrub: kill dead code Darrick J. Wong
2018-02-02 21:46   ` Eric Sandeen
2018-02-02 21:36 ` [PATCH 4/4] xfs_scrub: log operational messages when interactive Darrick J. Wong
2018-02-05 16:50 ` [PATCH 5/4] xfs_io: fix copy_file_range symbol name collision Darrick J. Wong
2018-02-05 17:21   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.