]> git.michaelhowe.org Git - packages/o/openafs.git/commit
volser: ensure GCTrans transaction walk remains valid
authorMark Vitale <mvitale@sinenomine.net>
Fri, 17 Aug 2018 22:48:08 +0000 (18:48 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 21 Dec 2018 11:31:54 +0000 (06:31 -0500)
commit318330ca51a3ba780471f4c05221be1f8e3897d1
tree28c52da45fa4805440be4cd4cd24f48c6bfcf96b
parentb0920d0a07a2aec55269002960bc71a9a9b99411
volser: ensure GCTrans transaction walk remains valid

Commit bc56f5cc97a982ee29219e6f258b372dbfe1a020 ("volser: Delete
timed-out temporary volumes") introduced new logic to GCTrans().
Unfortunately, part of this logic temporarily drops VTRANS_LOCK in order
to call VPurgeVolume().  While this lock is dropped, other volser_trans
may be added or deleted from the allTrans list.  Therefore, GCTrans
should not trust the next pointer (nt = tt->next) which was obtained
before the lock was dropped.

One symptom observed in the field was a segfault while examining
tt->volume.  Neither tt nor volume were valid any longer, since tt had
been set from a stale nt at the top of the loop.

To repair, improve, and clarify this logic:
- Refactor so nt is assigned correctly and as late as possible.
- Add comments to explain the placement of the assigns to future
maintainers.

Reviewed-on: https://gerrit.openafs.org/13286
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 930d8ee638112ca8bf27a9528c0a527cfab54c7d)

Change-Id: I9ed2c0440b03137cb0e0ef536167be9535c90dbb
Reviewed-on: https://gerrit.openafs.org/13337
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/volser/voltrans.c