All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH 00/14] multipath: fixes for sysfs accessors
@ 2022-07-06 14:38 mwilck
  2022-07-06 14:38 ` [dm-devel] [PATCH 01/14] libmultipath: alua: remove get_sysfs_pg83() mwilck
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: mwilck @ 2022-07-06 14:38 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

This set fixes some strangeness in our sysfs accessors which I
found while looking at
https://github.com/opensvc/multipath-tools/issues/35#issuecomment-1175901745.
(The patches don't fix this issue, which seems to be related to
Debian's initramfs setup).

Most importantly, sysfs_attr_get_value() and sysfs_attr_set_value()
would return 0 if the number of bytes read/written was different from
the expected value, which is non-standard and unexpected. This
series changes the return value semantics of these functions:

 - in sysfs_attr_get_value(), if a read buffer is too small to hold
   the string read plus a terminating 0 byte, the return value
   equals the buffer size.
 - in sysfs_bin_attr_get_value(), no 0 bytes are appended. It's not
   an error if the read buffer is completely filled, and no warning
   is printed in this case.
 - sysfs_attr_set_value() always returns the number of bytes written
   unless an error occured in open() or write().

Tests for the new semantics are added. Moreover, the sysfs.c code
is slightly refactored to avoid code duplication.

Martin Wilck (14):
  libmultipath: alua: remove get_sysfs_pg83()
  libmultipath: remove sysfs_get_binary()
  libmultipath: sysfs_bin_attr_get_value(): no error if buffer is filled
  libmultipath: common code path for sysfs_attr_get_value()
  libmultipath: sanitize error checking in sysfs accessors
  libmultipath: get rid of PATH_SIZE
  libmultipath: sysfs_attr_get_value(): don't return 0 if buffer too
    small
  libmultipath: sysfs_attr_set_value(): don't return 0 on partial write
  libmultipath: sysfs: cleanup file descriptors on pthread_cancel()
  libmultipath, multipathd: log failure setting sysfs attributes
  multipath tests: expect_condlog: skip depending on verbosity
  multipath tests: __wrap_dlog: print log message
  multipath tests: add sysfs test
  libmultipath.version: bump version for sysfs accessors

 libmultipath/configure.c              |  30 +-
 libmultipath/discovery.c              | 120 +++----
 libmultipath/libmultipath.version     |   8 +-
 libmultipath/prioritizers/alua_rtpg.c |  57 +--
 libmultipath/propsel.c                |   6 +-
 libmultipath/structs.h                |   3 -
 libmultipath/sysfs.c                  | 191 ++++------
 libmultipath/sysfs.h                  |  23 ++
 libmultipath/util.c                   |   8 +-
 multipathd/cli_handlers.c             |   2 +-
 multipathd/fpin_handlers.c            |  11 +-
 multipathd/main.c                     |  40 ++-
 tests/Makefile                        |   5 +-
 tests/sysfs.c                         | 494 ++++++++++++++++++++++++++
 tests/test-lib.c                      |   1 -
 tests/test-log.c                      |   5 +
 16 files changed, 751 insertions(+), 253 deletions(-)
 create mode 100644 tests/sysfs.c

-- 
2.36.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

end of thread, other threads:[~2022-07-12 19:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 14:38 [dm-devel] [PATCH 00/14] multipath: fixes for sysfs accessors mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 01/14] libmultipath: alua: remove get_sysfs_pg83() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 02/14] libmultipath: remove sysfs_get_binary() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 03/14] libmultipath: sysfs_bin_attr_get_value(): no error if buffer is filled mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 04/14] libmultipath: common code path for sysfs_attr_get_value() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 05/14] libmultipath: sanitize error checking in sysfs accessors mwilck
2022-07-12 19:07   ` Benjamin Marzinski
2022-07-06 14:38 ` [dm-devel] [PATCH 06/14] libmultipath: get rid of PATH_SIZE mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 07/14] libmultipath: sysfs_attr_get_value(): don't return 0 if buffer too small mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 08/14] libmultipath: sysfs_attr_set_value(): don't return 0 on partial write mwilck
2022-07-12 19:10   ` Benjamin Marzinski
2022-07-06 14:38 ` [dm-devel] [PATCH 09/14] libmultipath: sysfs: cleanup file descriptors on pthread_cancel() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 10/14] libmultipath, multipathd: log failure setting sysfs attributes mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 11/14] multipath tests: expect_condlog: skip depending on verbosity mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 12/14] multipath tests: __wrap_dlog: print log message mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 13/14] multipath tests: add sysfs test mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 14/14] libmultipath.version: bump version for sysfs accessors mwilck
2022-07-12 19:11 ` [dm-devel] [PATCH 00/14] multipath: fixes " Benjamin Marzinski

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.