]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Btrfs: add fiemap's flag check
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>
Thu, 29 Nov 2012 05:08:26 +0000 (05:08 +0000)
committerChris Mason <chris.mason@fusionio.com>
Mon, 17 Dec 2012 01:46:16 +0000 (20:46 -0500)
When the flag not supported is specified, it is necessary to return the error
to the caller.
So, we add the validity check of the fiemap's flag.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/inode.c

index d7bf2e7ee8a08b8fc11a12a39d8a1d6ec4f7e561..a1761f01cf11b25c0ebc0dc5dfde83b1033fb5a9 100644 (file)
@@ -6595,9 +6595,17 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
                   btrfs_submit_direct, 0);
 }
 
+#define BTRFS_FIEMAP_FLAGS     (FIEMAP_FLAG_SYNC)
+
 static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                __u64 start, __u64 len)
 {
+       int     ret;
+
+       ret = fiemap_check_flags(fieinfo, BTRFS_FIEMAP_FLAGS);
+       if (ret)
+               return ret;
+
        return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap);
 }