Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerBerger committed Dec 17, 2021
2 parents 3e0c490 + 160f187 commit bde0f15
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sbin/ws_expirer
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,22 @@ for fs in fslist:
print(" FAILED to access", fs, "in config file")
continue
spaces = config["workspaces"][fs]["spaces"]
# avoid datarace, fetch directories first and db entries second (1),
# so entries created during this run of expirer will be ignored
# this eats memory, but... generators from python3 pathlib.Path.glob
# would reintroduce the race.
workspaces={}
for space in spaces:
workspaces[space]=glob.glob(os.path.join(space,"*-*"))

dbentries = glob.glob(os.path.join(dbdir,"*-*"))
dbentrynames = list(map(os.path.basename, dbentries)) # (1)
dbentriesws=get_dbentriesws(dbentries)
dbentryworkspaces=list(map(os.path.basename, dbentriesws))
workspacedelprefix = config["workspaces"][fs]["deleted"]
print("PHASE: checking for stray workspaces for", fs, dbdir, spaces)
for space in spaces:
# FIXME: #87 here is potential datarace. DB entries from (1) will not
# show for workspaces created between (1) and (2), this could lead
# to deletion of workspaces allocated during expirer run!
for ws in glob.glob(os.path.join(space,"*-*")): # (2)
#if os.path.basename(ws) not in dbentrynames:
for ws in workspaces[space]: # (2) for for #87
if os.path.basename(ws) not in dbentryworkspaces:
print(" stray workspace", ws)
# FIXME: this could fail on scatefs, should fallback to 'mv'. Lustre DNE2 cross MDT renames work well meanwhile
Expand Down

0 comments on commit bde0f15

Please sign in to comment.