[Gluster-Maintainers] Improve robustness by checking result of pthread_mutex_lock()

Niels de Vos ndevos at redhat.com
Sun Aug 28 11:14:05 UTC 2016


Hi,

While working on some code, I notices that there are quite some calls to
pthread_mutex_lock() that do not check for the return value. There might
be cases where obtaining the lock fails, and in many cases this would
just be ignored. Needless to say, this might cause incorrect updates to
the data structures that the pthread_mutex intends to prevent.

I have filed https://bugzilla.redhat.com/1370921 for this issue, but may
add more dependent bugs for different components. What do other
maintainers prefer to use for tracking corrections like this?

Thanks,
Niels


    $ git grep pthread_mutex_lock '*.[ch]' \
        | grep -v '= pthread_mutex_lock' | cut -d : -f 1 | uniq -c \
        | sort -rn
     28 xlators/features/locks/src/posix.c
     27 rpc/rpc-lib/src/rpc-clnt.c
     23 rpc/rpc-transport/rdma/src/rdma.c
     19 rpc/rpc-transport/socket/src/socket.c
     19 libglusterfs/src/logging.c
     19 libglusterfs/src/inode.c
     16 xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
     16 xlators/features/bit-rot/src/bitd/bit-rot.c
     15 libglusterfs/src/syncop.c
     14 xlators/mount/fuse/src/fuse-bridge.c
     14 rpc/rpc-lib/src/rpcsvc.c
     13 xlators/features/locks/src/entrylk.c
     11 xlators/features/leases/src/leases-internal.c
     11 xlators/cluster/dht/src/tier.c
     10 xlators/features/locks/src/inodelk.c
      8 xlators/protocol/client/src/client.c
      8 libglusterfs/src/fd.c
      8 libglusterfs/src/event-epoll.c
      7 xlators/protocol/client/src/client-handshake.c
      7 xlators/cluster/dht/src/dht-rebalance.c
      7 libglusterfs/src/event-poll.c
      6 xlators/protocol/server/src/server.c
      6 xlators/protocol/client/src/client-lk.c
      6 libglusterfs/src/iobuf.c
      5 xlators/features/upcall/src/upcall-internal.c
      5 xlators/features/locks/src/reservelk.c
      5 xlators/features/locks/src/common.c
      5 xlators/features/locks/src/clear.c
      5 xlators/features/changelog/lib/src/gf-changelog-reborp.c
      5 rpc/rpc-lib/src/rpc-clnt-ping.c
      4 xlators/protocol/client/src/client-rpc-fops.c
      4 xlators/performance/io-threads/src/io-threads.c
      4 xlators/performance/io-cache/src/io-cache.h
      4 xlators/mgmt/glusterd/src/glusterd.c
      4 xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c
      4 xlators/cluster/ec/src/ec-heald.c
      4 xlators/cluster/afr/src/afr-self-heald.c
      4 libglusterfs/src/syncop-utils.c
      4 cli/src/cli-cmd.c
      4 api/src/glfs.c
      3 xlators/storage/posix/src/posix.c
      3 xlators/performance/read-ahead/src/read-ahead.h
      3 xlators/mgmt/glusterd/src/glusterd-utils.c
      3 xlators/features/protect/src/prot_dht.c
      3 xlators/features/changelog/src/changelog-helpers.c
      3 tools/gfind_missing_files/gcrawler.c
      3 libglusterfs/src/event.c
      3 libglusterfs/src/circ-buff.c
      3 api/src/glfs-resolve.c
      3 api/src/glfs-mgmt.c
      3 api/src/glfs-master.c
      3 api/src/glfs-handleops.c
      3 api/src/glfs-fops.c
      2 xlators/storage/posix/src/posix-helpers.c
      2 xlators/mount/fuse/src/fuse-helpers.c
      2 xlators/mgmt/glusterd/src/glusterd-syncop.c
      2 xlators/mgmt/glusterd/src/glusterd-statedump.c
      2 xlators/mgmt/glusterd/src/glusterd-mgmt.c
      2 xlators/mgmt/glusterd/src/glusterd-hooks.c
      2 xlators/features/index/src/index.c
      2 xlators/features/changelog/src/changelog-ev-handle.c
      2 xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
      2 xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c
      2 xlators/features/bit-rot/src/stub/bit-rot-stub.c
      2 xlators/experimental/fdl/src/fdl-tmpl.c
      2 rpc/rpc-lib/src/rpc-transport.c
      2 libglusterfs/src/throttle-tbf.c
      2 libglusterfs/src/syncop.h
      2 libglusterfs/src/rot-buffs.c
      2 libglusterfs/src/locking.h
      1 xlators/protocol/server/src/server-helpers.c
      1 xlators/protocol/client/src/client-helpers.c
      1 xlators/nfs/server/src/nfs-fops.c
      1 xlators/features/trash/src/trash.c
      1 xlators/features/leases/src/leases.h
      1 xlators/features/changelog/lib/src/gf-changelog.c
      1 xlators/cluster/dht/src/dht-shared.c
      1 xlators/cluster/afr/src/afr-transaction.c
      1 libglusterfs/src/statedump.c
      1 extras/benchmarking/rdd.c
      1 api/src/glfs-internal.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.gluster.org/pipermail/maintainers/attachments/20160828/7b1ab754/attachment.sig>


More information about the maintainers mailing list