Skip to content

Commit

Permalink
Disable logged writes for crash safety
Browse files Browse the repository at this point in the history
opqueue just confuses the issue since it makes the file-system no longer
cleanly unmount. Logged writes don't actually have a proof, and don't
actually interact with fdatasync the way we intended (specifically, they
should be synced even from the in-memory log upon an fdatasync).
  • Loading branch information
tchajed committed Oct 3, 2018
1 parent 31cf5f7 commit 97b50ec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/fscq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ cachesize = 100000
-- using its own threads).
-- Disabled by default: seems to be buggy
-- (1) FSCQ no longer terminates gracefully in response to SIGTERM
-- (2) More seriously, data doesn't seem to be persisted correctly
-- (2) fuseDestroy (and thus AsyncFS.umount) are not called with opqueue, for
-- unclear reasons
useDowncalls :: Bool
useDowncalls = False

Expand Down Expand Up @@ -492,16 +493,22 @@ fscqWrite fr m_fsxp _ inum bs offset = withMVar m_fsxp $ \fsxp -> do
(wlen, ()) <- fr $ AsyncFS._AFS__file_get_sz fsxp inum
len <- return $ fromIntegral $ wordToNat 64 wlen
endpos <- return $ (fromIntegral offset) + (fromIntegral (BS.length bs))
-- NOTE: logged writes are disabled since they are not crash safe
-- (the design of DFSCQ should permit them to be crash safe, but the proofs
-- don't cover mixing direct and logged writes, and logged writes currently
-- are not synced correctly)
(okspc, do_log) <- if len < endpos then do
(ok, _) <- fr $ AsyncFS._AFS__file_truncate fsxp inum ((endpos + 4095) `div` 4096)
return (ok, True)
--return (ok, True)
return (ok, False)
else do
bslen <- return $ fromIntegral $ BS.length bs
if ((fromIntegral offset) `mod` 4096 == 0) && (bslen `mod` 4096 == 0) && bslen > 4096 * 5 then
-- block is large and aligned -> bypass write
return $ (Errno.OK (), False)
else
return $ (Errno.OK (), True)
-- return $ (Errno.OK (), True)
return $ (Errno.OK (), False)
case okspc of
Errno.OK _ -> do
r <- foldM (write_piece do_log fsxp len) (WriteOK 0) (compute_range_pieces offset bs)
Expand Down

0 comments on commit 97b50ec

Please sign in to comment.