From: Tsutomu Itoh Date: Thu, 29 Nov 2012 05:08:26 +0000 (+0000) Subject: Btrfs: add fiemap's flag check X-Git-Tag: v3.8~29^2~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05dadc09f52ad5a631da1aa8767c5b80e121f0c4;p=platform%2Fkernel%2Flinux-amlogic.git Btrfs: add fiemap's flag check 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d7bf2e7..a1761f0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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); }