]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: check ioctl SYNC return code
authorSage Weil <sage@inktank.com>
Tue, 2 Oct 2012 04:02:43 +0000 (21:02 -0700)
committerSage Weil <sage@inktank.com>
Tue, 2 Oct 2012 04:02:43 +0000 (21:02 -0700)
CID 716860: Unchecked return value (CHECKED_RETURN)
At (22): Calling function "ioctl(int, unsigned long, ...)" without checking return value (as is done elsewhere 30 out of 31 times).

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/FileStore.cc

index 2cfcd807013bebf758e65447a7beda8fbfbbb574..94dbee9ed32c334ccb16955d3054c0dfae8b593e 100644 (file)
@@ -3743,7 +3743,12 @@ void FileStore::sync_entry()
        if (btrfs) {
          dout(15) << "sync_entry doing btrfs SYNC" << dendl;
          // do a full btrfs commit
-         ::ioctl(op_fd, BTRFS_IOC_SYNC);
+         int r = ::ioctl(op_fd, BTRFS_IOC_SYNC);
+         if (r < 0) {
+           r = -errno;
+           derr << "sync_entry btrfs IOC_SYNC got " << cpp_strerror(r) << dendl;
+           assert(0 == "btrfs sync ioctl returned error");
+         }
        } else
         if (m_filestore_fsync_flushes_journal_data) {
          dout(15) << "sync_entry doing fsync on " << current_op_seq_fn << dendl;