Loading fs/btrfs/send.c +4 −14 Original line number Original line Diff line number Diff line Loading @@ -539,33 +539,23 @@ static struct btrfs_path *alloc_path_for_send(void) static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) { { int ret; int ret; mm_segment_t old_fs; u32 pos = 0; u32 pos = 0; old_fs = get_fs(); set_fs(KERNEL_DS); while (pos < len) { while (pos < len) { ret = vfs_write(filp, (__force const char __user *)buf + pos, ret = kernel_write(filp, buf + pos, len - pos, off); len - pos, off); /* TODO handle that correctly */ /* TODO handle that correctly */ /*if (ret == -ERESTARTSYS) { /*if (ret == -ERESTARTSYS) { continue; continue; }*/ }*/ if (ret < 0) if (ret < 0) goto out; return ret; if (ret == 0) { if (ret == 0) { ret = -EIO; return -EIO; goto out; } } pos += ret; pos += ret; } } ret = 0; return 0; out: set_fs(old_fs); return ret; } } static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len) static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len) Loading Loading
fs/btrfs/send.c +4 −14 Original line number Original line Diff line number Diff line Loading @@ -539,33 +539,23 @@ static struct btrfs_path *alloc_path_for_send(void) static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) { { int ret; int ret; mm_segment_t old_fs; u32 pos = 0; u32 pos = 0; old_fs = get_fs(); set_fs(KERNEL_DS); while (pos < len) { while (pos < len) { ret = vfs_write(filp, (__force const char __user *)buf + pos, ret = kernel_write(filp, buf + pos, len - pos, off); len - pos, off); /* TODO handle that correctly */ /* TODO handle that correctly */ /*if (ret == -ERESTARTSYS) { /*if (ret == -ERESTARTSYS) { continue; continue; }*/ }*/ if (ret < 0) if (ret < 0) goto out; return ret; if (ret == 0) { if (ret == 0) { ret = -EIO; return -EIO; goto out; } } pos += ret; pos += ret; } } ret = 0; return 0; out: set_fs(old_fs); return ret; } } static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len) static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len) Loading