diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,8 @@
+#### 0.2.1.0 *2023-06-23*
+
+	* Support building with `ghc-9`.
+	* Support building with `unix-2.8`.
+
 #### 0.2.0.0 *2018-10-25*
 
 	* Implement getFSInfo.
diff --git a/System/Linux/Btrfs.hsc b/System/Linux/Btrfs.hsc
--- a/System/Linux/Btrfs.hsc
+++ b/System/Linux/Btrfs.hsc
@@ -96,7 +96,7 @@
     ) where
 
 import System.Posix.Types
-import System.Posix.IO hiding (openFd)
+import System.Posix.IO hiding (openFd, sync)
 import System.Posix.Files
 import System.IO.Error
 import Control.Exception
@@ -184,7 +184,7 @@
     withFd srcPath ReadOnly $ \srcFd -> do
         stat <- getFdStatus srcFd
         let mode = fileMode stat
-        bracket (openFd dstPath WriteOnly (Just mode) defaultFileFlags {trunc = True}) closeFd $ \dstFd ->
+        bracket (openFd dstPath WriteOnly defaultFileFlags {trunc = True, creat = Just mode}) closeFd $ \dstFd ->
             cloneFd srcFd dstFd
 
 cloneRangeFd :: Fd -> FileSize -> FileSize -> Fd -> FileSize -> IO ()
@@ -1247,12 +1247,12 @@
 
 withFd :: FILEPATH -> OpenMode -> (Fd -> IO r) -> IO r
 withFd path openMode action =
-    bracket (openFd path openMode Nothing defaultFileFlags {nonBlock = True})
+    bracket (openFd path openMode defaultFileFlags {nonBlock = True})
             closeFd action
 
 withSplitPathOpenParent :: String -> Int -> FILEPATH -> (CStringLen -> Fd -> IO r) -> IO r
 withSplitPathOpenParent loc maxLen path action =
-    unsafeWithFilePathLen name $ \cName @ (_, l) -> do
+    unsafeWithFilePathLen name $ \cName@(_, l) -> do
         unless (l <= maxLen) $
             ioError $ flip ioeSetErrorString "the subvolume name is too long"
                     $ mkIOError illegalOperationErrorType loc Nothing (Just (asString name))
diff --git a/System/Linux/Btrfs/ByteString.hsc b/System/Linux/Btrfs/ByteString.hsc
--- a/System/Linux/Btrfs/ByteString.hsc
+++ b/System/Linux/Btrfs/ByteString.hsc
@@ -96,7 +96,7 @@
     ) where
 
 import System.Posix.Types
-import System.Posix.IO hiding (openFd)
+import System.Posix.IO hiding (openFd, sync)
 import System.Posix.Files
 import System.IO.Error
 import Control.Exception
@@ -184,7 +184,7 @@
     withFd srcPath ReadOnly $ \srcFd -> do
         stat <- getFdStatus srcFd
         let mode = fileMode stat
-        bracket (openFd dstPath WriteOnly (Just mode) defaultFileFlags {trunc = True}) closeFd $ \dstFd ->
+        bracket (openFd dstPath WriteOnly defaultFileFlags {trunc = True, creat = Just mode}) closeFd $ \dstFd ->
             cloneFd srcFd dstFd
 
 cloneRangeFd :: Fd -> FileSize -> FileSize -> Fd -> FileSize -> IO ()
@@ -1247,12 +1247,12 @@
 
 withFd :: FILEPATH -> OpenMode -> (Fd -> IO r) -> IO r
 withFd path openMode action =
-    bracket (openFd path openMode Nothing defaultFileFlags {nonBlock = True})
+    bracket (openFd path openMode defaultFileFlags {nonBlock = True})
             closeFd action
 
 withSplitPathOpenParent :: String -> Int -> FILEPATH -> (CStringLen -> Fd -> IO r) -> IO r
 withSplitPathOpenParent loc maxLen path action =
-    unsafeWithFilePathLen name $ \cName @ (_, l) -> do
+    unsafeWithFilePathLen name $ \cName@(_, l) -> do
         unless (l <= maxLen) $
             ioError $ flip ioeSetErrorString "the subvolume name is too long"
                     $ mkIOError illegalOperationErrorType loc Nothing (Just (asString name))
diff --git a/System/Linux/Btrfs/FilePathLike.hs b/System/Linux/Btrfs/FilePathLike.hs
--- a/System/Linux/Btrfs/FilePathLike.hs
+++ b/System/Linux/Btrfs/FilePathLike.hs
@@ -30,7 +30,7 @@
     withFilePath :: s -> (CString -> IO a) -> IO a
     withFilePathLen :: s -> (CStringLen -> IO a) -> IO a
     unsafeWithFilePathLen :: s -> (CStringLen -> IO a) -> IO a
-    openFd :: s -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd
+    openFd :: s -> OpenMode -> OpenFileFlags -> IO Fd
     dropTrailingSlash :: s -> s
     (</>) :: s -> s -> s
     splitFileName :: s -> (s, s)
diff --git a/btrfs.cabal b/btrfs.cabal
--- a/btrfs.cabal
+++ b/btrfs.cabal
@@ -1,5 +1,5 @@
 name:                btrfs
-version:             0.2.0.0
+version:             0.2.1.0
 synopsis:            Bindings to the btrfs API
 description:
   This package provides bindings to the low-level btrfs API (i.e. the
@@ -50,8 +50,10 @@
   other-modules:       Data.Word.Endian,
                        System.Linux.Btrfs.FilePathLike,
                        System.Linux.Capabilities
-  build-depends:       base >=4.6 && <5, unix >=2.6,
-                       time >=1.4, bytestring >=0.9
+  build-depends:       base >=4.6 && <5
+                       , unix >=2.8 && <3.0
+                       , time >=1.4 && <2.0
+                       , bytestring >=0.9 && <1.0
   include-dirs:        include
   build-tools:         hsc2hs
   default-language:    Haskell2010
