History

Merge branches 'work.namei', 'work.dcache' and 'work.iov_iter' into for-linus

Al Viro committed 9 years ago

Commit c4364f84 parents 1d0fd57 8f64fb1 ad5cb12 0b62fca34 files · +221 −316Browse files

Unified · Split

34 files
  1. drivers/bluetooth/hci_vhci.c +1 −1
  2. drivers/net/macvtap.c +1 −3
  3. drivers/net/tun.c +2 −5
  4. drivers/staging/lustre/lustre/llite/dcache.c +7 −26
  5. drivers/staging/lustre/lustre/llite/llite_internal.h +3 −14
  6. drivers/staging/lustre/lustre/llite/llite_nfs.c +6 −16
  7. drivers/staging/lustre/lustre/llite/namei.c +1 −12
  8. drivers/staging/lustre/lustre/llite/statahead.c +1 −3
  9. drivers/usb/gadget/function/f_fs.c +1 −1
  10. drivers/usb/gadget/legacy/inode.c +1 −1
  11. drivers/vhost/scsi.c +1 −2
  12. drivers/vhost/vhost.c +1 −2
  13. fs/ceph/dir.c +5 −46
  14. fs/ceph/export.c +2 −24
  15. fs/ceph/file.c +0 −4
  16. fs/ceph/inode.c +6 −16
  17. fs/ceph/super.c +1 −1
  18. fs/ceph/super.h +1 −9
  19. fs/namei.c +54 −93
  20. fs/ncpfs/file.c +1 −1
  21. fs/orangefs/devorangefs-req.c +4 −9
  22. include/linux/skbuff.h +3 −3
  23. include/linux/uio.h +3 −0
  24. include/net/sock.h +3 −3
  25. include/net/udplite.h +1 −1
  26. kernel/printk/printk.c +1 −1
  27. lib/iov_iter.c +96 −2
  28. net/atm/common.c +1 −1
  29. net/bluetooth/l2cap_core.c +3 −3
  30. net/ipv4/ip_output.c +2 −2
  31. net/ipv4/ping.c +4 −4
  32. net/packet/af_packet.c +1 −4
  33. net/tipc/msg.c +2 −2
  34. security/keys/keyctl.c +1 −1
drivers/bluetooth/hci_vhci.c+1−1
@@ -181,7 +181,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *data, · 180 unmodified lines
181181 if (!skb)
182182 return -ENOMEM;
183183
184− if (copy_from_iter(skb_put(skb, len), len, from) != len) {
184+ if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
185185 kfree_skb(skb);
186186 return -EFAULT;
187187 }
drivers/net/macvtap.c+1−3
@@ -673,7 +673,6 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, · 672 unmodified lines
673673 int depth;
674674 bool zerocopy = false;
675675 size_t linear;
676− ssize_t n;
677676
678677 if (q->flags & IFF_VNET_HDR) {
679678 vnet_hdr_len = q->vnet_hdr_sz;
@@ -684,8 +683,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, · 4 unmodified lines
684683 len -= vnet_hdr_len;
685684
686685 err = -EFAULT;
687− n = copy_from_iter(&vnet_hdr, sizeof(vnet_hdr), from);
688− if (n != sizeof(vnet_hdr))
686+ if (!copy_from_iter_full(&vnet_hdr, sizeof(vnet_hdr), from))
689687 goto err;
690688 iov_iter_advance(from, vnet_hdr_len - sizeof(vnet_hdr));
691689 if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
drivers/net/tun.c+2−5
@@ -1171,7 +1171,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 1170 unmodified lines
11711171 bool zerocopy = false;
11721172 int err;
11731173 u32 rxhash;
1174− ssize_t n;
11751174
11761175 if (!(tun->dev->flags & IFF_UP))
11771176 return -EIO;
@@ -1181,8 +1180,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 3 unmodified lines
11811180 return -EINVAL;
11821181 len -= sizeof(pi);
11831182
1184− n = copy_from_iter(&pi, sizeof(pi), from);
1185− if (n != sizeof(pi))
1183+ if (!copy_from_iter_full(&pi, sizeof(pi), from))
11861184 return -EFAULT;
11871185 }
11881186
@@ -1191,8 +1189,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 2 unmodified lines
11911189 return -EINVAL;
11921190 len -= tun->vnet_hdr_sz;
11931191
1194− n = copy_from_iter(&gso, sizeof(gso), from);
1195− if (n != sizeof(gso))
1192+ if (!copy_from_iter_full(&gso, sizeof(gso), from))
11961193 return -EFAULT;
11971194
11981195 if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
drivers/staging/lustre/lustre/llite/dcache.c+7−26
@@ -57,9 +57,6 @@ static void ll_release(struct dentry *de) · 56 unmodified lines
5757
5858 LASSERT(de);
5959 lld = ll_d2d(de);
60− if (!lld) /* NFS copies the de->d_op methods (bug 4655) */
61− return;
62−
6360 if (lld->lld_it) {
6461 ll_intent_release(lld->lld_it);
6562 kfree(lld->lld_it);
@@ -126,30 +123,13 @@ static int ll_ddelete(const struct dentry *de) · 60 unmodified lines
126123 return 0;
127124 }
128125
129−int ll_d_init(struct dentry *de)
126+static int ll_d_init(struct dentry *de)
130127 {
131− CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n",
132− de, de, de->d_parent, d_inode(de), d_count(de));
133−
134− if (!de->d_fsdata) {
135− struct ll_dentry_data *lld;
136−
137− lld = kzalloc(sizeof(*lld), GFP_NOFS);
138− if (likely(lld)) {
139− spin_lock(&de->d_lock);
140− if (likely(!de->d_fsdata)) {
141− de->d_fsdata = lld;
142− __d_lustre_invalidate(de);
143− } else {
144− kfree(lld);
145− }
146− spin_unlock(&de->d_lock);
147− } else {
148− return -ENOMEM;
149− }
150− }
151− LASSERT(de->d_op == &ll_d_ops);
152−
128+ struct ll_dentry_data *lld = kzalloc(sizeof(*lld), GFP_KERNEL);
129+ if (unlikely(!lld))
130+ return -ENOMEM;
131+ lld->lld_invalid = 1;
132+ de->d_fsdata = lld;
153133 return 0;
154134 }
155135
@@ -300,6 +280,7 @@ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) · 144 unmodified lines
300280 }
301281
302282 const struct dentry_operations ll_d_ops = {
283+ .d_init = ll_d_init,
303284 .d_revalidate = ll_revalidate_nd,
304285 .d_release = ll_release,
305286 .d_delete = ll_ddelete,
drivers/staging/lustre/lustre/llite/llite_internal.h+3−14
@@ -801,7 +801,6 @@ int ll_hsm_release(struct inode *inode); · 800 unmodified lines
801801
802802 /* llite/dcache.c */
803803
804−int ll_d_init(struct dentry *de);
805804 extern const struct dentry_operations ll_d_ops;
806805 void ll_intent_drop_lock(struct lookup_intent *);
807806 void ll_intent_release(struct lookup_intent *);
@@ -1189,7 +1188,7 @@ dentry_may_statahead(struct inode *dir, struct dentry *dentry) · 381 unmodified lines
11891188 * 'lld_sa_generation == lli->lli_sa_generation'.
11901189 */
11911190 ldd = ll_d2d(dentry);
1192− if (ldd && ldd->lld_sa_generation == lli->lli_sa_generation)
1191+ if (ldd->lld_sa_generation == lli->lli_sa_generation)
11931192 return false;
11941193
11951194 return true;
@@ -1317,17 +1316,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, · 121 unmodified lines
13171316
13181317 static inline int d_lustre_invalid(const struct dentry *dentry)
13191318 {
1320− struct ll_dentry_data *lld = ll_d2d(dentry);
1321−
1322− return !lld || lld->lld_invalid;
1323−}
1324−
1325−static inline void __d_lustre_invalidate(struct dentry *dentry)
1326−{
1327− struct ll_dentry_data *lld = ll_d2d(dentry);
1328−
1329− if (lld)
1330− lld->lld_invalid = 1;
1319+ return ll_d2d(dentry)->lld_invalid;
13311320 }
13321321
13331322 /*
@@ -1343,7 +1332,7 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested) · 9 unmodified lines
13431332
13441333 spin_lock_nested(&dentry->d_lock,
13451334 nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
1346− __d_lustre_invalidate(dentry);
1335+ ll_d2d(dentry)->lld_invalid = 1;
13471336 /*
13481337 * We should be careful about dentries created by d_obtain_alias().
13491338 * These dentries are not put in the dentry tree, instead they are
drivers/staging/lustre/lustre/llite/llite_nfs.c+6−16
@@ -169,22 +169,12 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren · 168 unmodified lines
169169 /* N.B. d_obtain_alias() drops inode ref on error */
170170 result = d_obtain_alias(inode);
171171 if (!IS_ERR(result)) {
172− int rc;
173−
174− rc = ll_d_init(result);
175− if (rc < 0) {
176− dput(result);
177− result = ERR_PTR(rc);
178− } else {
179− struct ll_dentry_data *ldd = ll_d2d(result);
180−
181− /*
182− * Need to signal to the ll_intent_file_open that
183− * we came from NFS and so opencache needs to be
184− * enabled for this one
185− */
186− ldd->lld_nfs_dentry = 1;
187− }
172+ /*
173+ * Need to signal to the ll_intent_file_open that
174+ * we came from NFS and so opencache needs to be
175+ * enabled for this one
176+ */
177+ ll_d2d(result)->lld_nfs_dentry = 1;
188178 }
189179
190180 return result;
drivers/staging/lustre/lustre/llite/namei.c+1−12
@@ -395,17 +395,9 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) · 394 unmodified lines
395395 */
396396 struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
397397 {
398− struct dentry *new;
399− int rc;
400−
401398 if (inode) {
402− new = ll_find_alias(inode, de);
399+ struct dentry *new = ll_find_alias(inode, de);
403400 if (new) {
404− rc = ll_d_init(new);
405− if (rc < 0) {
406− dput(new);
407− return ERR_PTR(rc);
408− }
409401 d_move(new, de);
410402 iput(inode);
411403 CDEBUG(D_DENTRY,
@@ -414,9 +406,6 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) · 2 unmodified lines
414406 return new;
415407 }
416408 }
417− rc = ll_d_init(de);
418− if (rc < 0)
419− return ERR_PTR(rc);
420409 d_add(de, inode);
421410 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
422411 de, d_inode(de), d_count(de), de->d_flags);
drivers/staging/lustre/lustre/llite/statahead.c+1−3
@@ -1513,9 +1513,7 @@ out_unplug: · 1512 unmodified lines
15131513 */
15141514 ldd = ll_d2d(*dentryp);
15151515 lli = ll_i2info(dir);
1516− /* ldd can be NULL if llite lookup failed. */
1517− if (ldd)
1518− ldd->lld_sa_generation = lli->lli_sa_generation;
1516+ ldd->lld_sa_generation = lli->lli_sa_generation;
15191517 sa_put(sai, entry);
15201518 return rc;
15211519 }
drivers/usb/gadget/function/f_fs.c+1−1
@@ -949,7 +949,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) · 948 unmodified lines
949949 goto error_mutex;
950950 }
951951 if (!io_data->read &&
952− copy_from_iter(data, data_len, &io_data->data) != data_len) {
952+ !copy_from_iter_full(data, data_len, &io_data->data)) {
953953 ret = -EFAULT;
954954 goto error_mutex;
955955 }
drivers/usb/gadget/legacy/inode.c+1−1
@@ -667,7 +667,7 @@ ep_write_iter(struct kiocb *iocb, struct iov_iter *from) · 666 unmodified lines
667667 return -ENOMEM;
668668 }
669669
670− if (unlikely(copy_from_iter(buf, len, from) != len)) {
670+ if (unlikely(!copy_from_iter_full(buf, len, from))) {
671671 value = -EFAULT;
672672 goto out;
673673 }
drivers/vhost/scsi.c+1−2
@@ -922,8 +922,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) · 921 unmodified lines
922922 */
923923 iov_iter_init(&out_iter, WRITE, vq->iov, out, out_size);
924924
925− ret = copy_from_iter(req, req_size, &out_iter);
926− if (unlikely(ret != req_size)) {
925+ if (unlikely(!copy_from_iter_full(req, req_size, &out_iter))) {
927926 vq_err(vq, "Faulted on copy_from_iter\n");
928927 vhost_scsi_send_bad_target(vs, vq, head, out);
929928 continue;
drivers/vhost/vhost.c+1−2
@@ -1862,8 +1862,7 @@ static int get_indirect(struct vhost_virtqueue *vq, · 1861 unmodified lines
18621862 i, count);
18631863 return -EINVAL;
18641864 }
1865− if (unlikely(copy_from_iter(&desc, sizeof(desc), &from) !=
1866− sizeof(desc))) {
1865+ if (unlikely(!copy_from_iter_full(&desc, sizeof(desc), &from))) {
18671866 vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n",
18681867 i, (size_t)vhost64_to_cpu(vq, indirect->addr) + i * sizeof desc);
18691868 return -EINVAL;
fs/ceph/dir.c+5−46
@@ -32,40 +32,19 @@ const struct dentry_operations ceph_dentry_ops; · 31 unmodified lines
3232 /*
3333 * Initialize ceph dentry state.
3434 */
35−int ceph_init_dentry(struct dentry *dentry)
35+static int ceph_d_init(struct dentry *dentry)
3636 {
3737 struct ceph_dentry_info *di;
3838
39− if (dentry->d_fsdata)
40− return 0;
41−
4239 di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
4340 if (!di)
4441 return -ENOMEM; /* oh well */
4542
46− spin_lock(&dentry->d_lock);
47− if (dentry->d_fsdata) {
48− /* lost a race */
49− kmem_cache_free(ceph_dentry_cachep, di);
50− goto out_unlock;
51− }
52−
53− if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP)
54− d_set_d_op(dentry, &ceph_dentry_ops);
55− else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR)
56− d_set_d_op(dentry, &ceph_snapdir_dentry_ops);
57− else
58− d_set_d_op(dentry, &ceph_snap_dentry_ops);
59−
6043 di->dentry = dentry;
6144 di->lease_session = NULL;
6245 di->time = jiffies;
63− /* avoid reordering d_fsdata setup so that the check above is safe */
64− smp_mb();
6546 dentry->d_fsdata = di;
6647 ceph_dentry_lru_add(dentry);
67−out_unlock:
68− spin_unlock(&dentry->d_lock);
6948 return 0;
7049 }
7150
@@ -737,10 +716,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, · 665 unmodified lines
737716 if (dentry->d_name.len > NAME_MAX)
738717 return ERR_PTR(-ENAMETOOLONG);
739718
740− err = ceph_init_dentry(dentry);
741− if (err < 0)
742− return ERR_PTR(err);
743−
744719 /* can we conclude ENOENT locally? */
745720 if (d_really_is_negative(dentry)) {
746721 struct ceph_inode_info *ci = ceph_inode(dir);
@@ -1319,16 +1294,6 @@ static void ceph_d_release(struct dentry *dentry) · 572 unmodified lines
13191294 kmem_cache_free(ceph_dentry_cachep, di);
13201295 }
13211296
1322−static int ceph_snapdir_d_revalidate(struct dentry *dentry,
1323− unsigned int flags)
1324−{
1325− /*
1326− * Eventually, we'll want to revalidate snapped metadata
1327− * too... probably...
1328− */
1329− return 1;
1330−}
1331−
13321297 /*
13331298 * When the VFS prunes a dentry from the cache, we need to clear the
13341299 * complete flag on the parent directory.
@@ -1347,6 +1312,9 @@ static void ceph_d_prune(struct dentry *dentry) · 12 unmodified lines
13471312 if (d_unhashed(dentry))
13481313 return;
13491314
1315+ if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR)
1316+ return;
1317+
13501318 /*
13511319 * we hold d_lock, so d_parent is stable, and d_fsdata is never
13521320 * cleared until d_release
@@ -1517,14 +1485,5 @@ const struct dentry_operations ceph_dentry_ops = { · 164 unmodified lines
15171485 .d_revalidate = ceph_d_revalidate,
15181486 .d_release = ceph_d_release,
15191487 .d_prune = ceph_d_prune,
1520−};
1521−
1522−const struct dentry_operations ceph_snapdir_dentry_ops = {
1523− .d_revalidate = ceph_snapdir_d_revalidate,
1524− .d_release = ceph_d_release,
1525−};
1526−
1527−const struct dentry_operations ceph_snap_dentry_ops = {
1528− .d_release = ceph_d_release,
1529− .d_prune = ceph_d_prune,
1488+ .d_init = ceph_d_init,
15301489 };
fs/ceph/export.c+2−24
@@ -62,7 +62,6 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) · 61 unmodified lines
6262 {
6363 struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
6464 struct inode *inode;
65− struct dentry *dentry;
6665 struct ceph_vino vino;
6766 int err;
6867
@@ -94,16 +93,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) · 25 unmodified lines
9493 return ERR_PTR(-ESTALE);
9594 }
9695
97− dentry = d_obtain_alias(inode);
98− if (IS_ERR(dentry))
99− return dentry;
100− err = ceph_init_dentry(dentry);
101− if (err < 0) {
102− dput(dentry);
103− return ERR_PTR(err);
104− }
105− dout("__fh_to_dentry %llx %p dentry %p\n", ino, inode, dentry);
106− return dentry;
96+ return d_obtain_alias(inode);
10797 }
10898
10999 /*
@@ -131,7 +121,6 @@ static struct dentry *__get_parent(struct super_block *sb, · 21 unmodified lines
131121 struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
132122 struct ceph_mds_request *req;
133123 struct inode *inode;
134− struct dentry *dentry;
135124 int mask;
136125 int err;
137126
@@ -164,18 +153,7 @@ static struct dentry *__get_parent(struct super_block *sb, · 26 unmodified lines
164153 if (!inode)
165154 return ERR_PTR(-ENOENT);
166155
167− dentry = d_obtain_alias(inode);
168− if (IS_ERR(dentry))
169− return dentry;
170− err = ceph_init_dentry(dentry);
171− if (err < 0) {
172− dput(dentry);
173− return ERR_PTR(err);
174− }
175− dout("__get_parent ino %llx parent %p ino %llx.%llx\n",
176− child ? ceph_ino(d_inode(child)) : ino,
177− dentry, ceph_vinop(inode));
178− return dentry;
156+ return d_obtain_alias(inode);
179157 }
180158
181159 static struct dentry *ceph_get_parent(struct dentry *child)
fs/ceph/file.c+0−4
@@ -351,10 +351,6 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, · 350 unmodified lines
351351 if (dentry->d_name.len > NAME_MAX)
352352 return -ENAMETOOLONG;
353353
354− err = ceph_init_dentry(dentry);
355− if (err < 0)
356− return err;
357−
358354 if (flags & O_CREAT) {
359355 err = ceph_pre_init_acls(dir, &mode, &acls);
360356 if (err < 0)
fs/ceph/inode.c+6−16
@@ -1023,16 +1023,17 @@ static void update_dentry_lease(struct dentry *dentry, · 1022 unmodified lines
10231023 long unsigned half_ttl = from_time + (duration * HZ / 2) / 1000;
10241024 struct inode *dir;
10251025
1026− /* only track leases on regular dentries */
1027− if (dentry->d_op != &ceph_dentry_ops)
1028− return;
1029−
10301026 spin_lock(&dentry->d_lock);
10311027 dout("update_dentry_lease %p duration %lu ms ttl %lu\n",
10321028 dentry, duration, ttl);
10331029
10341030 /* make lease_rdcache_gen match directory */
10351031 dir = d_inode(dentry->d_parent);
1032+
1033+ /* only track leases on regular dentries */
1034+ if (ceph_snap(dir) != CEPH_NOSNAP)
1035+ goto out_unlock;
1036+
10361037 di->lease_shared_gen = ceph_inode(dir)->i_shared_gen;
10371038
10381039 if (duration == 0)
@@ -1202,12 +1203,7 @@ retry_lookup: · 163 unmodified lines
12021203 err = -ENOMEM;
12031204 goto done;
12041205 }
1205− err = ceph_init_dentry(dn);
1206− if (err < 0) {
1207− dput(dn);
1208− dput(parent);
1209− goto done;
1210− }
1206+ err = 0;
12111207 } else if (d_really_is_positive(dn) &&
12121208 (ceph_ino(d_inode(dn)) != vino.ino ||
12131209 ceph_snap(d_inode(dn)) != vino.snap)) {
@@ -1561,12 +1557,6 @@ retry_lookup: · 347 unmodified lines
15611557 err = -ENOMEM;
15621558 goto out;
15631559 }
1564− ret = ceph_init_dentry(dn);
1565− if (ret < 0) {
1566− dput(dn);
1567− err = ret;
1568− goto out;
1569− }
15701560 } else if (d_really_is_positive(dn) &&
15711561 (ceph_ino(d_inode(dn)) != vino.ino ||
15721562 ceph_snap(d_inode(dn)) != vino.snap)) {
fs/ceph/super.c+1−1
@@ -795,7 +795,6 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc, · 794 unmodified lines
795795 root = ERR_PTR(-ENOMEM);
796796 goto out;
797797 }
798− ceph_init_dentry(root);
799798 dout("open_root_inode success, root dentry is %p\n", root);
800799 } else {
801800 root = ERR_PTR(err);
@@ -879,6 +878,7 @@ static int ceph_set_super(struct super_block *s, void *data) · 77 unmodified lines
879878 fsc->sb = s;
880879
881880 s->s_op = &ceph_super_ops;
881+ s->s_d_op = &ceph_dentry_ops;
882882 s->s_export_op = &ceph_export_ops;
883883
884884 s->s_time_gran = 1000; /* 1000 ns == 1 us */
fs/ceph/super.h+1−9
@@ -934,8 +934,7 @@ extern const struct file_operations ceph_dir_fops; · 933 unmodified lines
934934 extern const struct file_operations ceph_snapdir_fops;
935935 extern const struct inode_operations ceph_dir_iops;
936936 extern const struct inode_operations ceph_snapdir_iops;
937−extern const struct dentry_operations ceph_dentry_ops, ceph_snap_dentry_ops,
938− ceph_snapdir_dentry_ops;
937+extern const struct dentry_operations ceph_dentry_ops;
939938
940939 extern loff_t ceph_make_fpos(unsigned high, unsigned off, bool hash_order);
941940 extern int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry);
@@ -951,13 +950,6 @@ extern void ceph_invalidate_dentry_lease(struct dentry *dentry); · 9 unmodified lines
951950 extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);
952951 extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl);
953952
954−/*
955− * our d_ops vary depending on whether the inode is live,
956− * snapshotted (read-only), or a virtual ".snap" directory.
957− */
958−int ceph_init_dentry(struct dentry *dentry);
959−
960−
961953 /* ioctl.c */
962954 extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
963955
fs/namei.c+54−93
@@ -1725,30 +1725,35 @@ static int pick_link(struct nameidata *nd, struct path *link, · 1724 unmodified lines
17251725 return 1;
17261726 }
17271727
1728+enum {WALK_FOLLOW = 1, WALK_MORE = 2};
1729+
17281730 /*
17291731 * Do we need to follow links? We _really_ want to be able
17301732 * to do this check without having to look at inode->i_op,
17311733 * so we keep a cache of "no, this doesn't need follow_link"
17321734 * for the common case.
17331735 */
1734−static inline int should_follow_link(struct nameidata *nd, struct path *link,
1735− int follow,
1736− struct inode *inode, unsigned seq)
1736+static inline int step_into(struct nameidata *nd, struct path *path,
1737+ int flags, struct inode *inode, unsigned seq)
17371738 {
1738− if (likely(!d_is_symlink(link->dentry)))
1739− return 0;
1740− if (!follow)
1739+ if (!(flags & WALK_MORE) && nd->depth)
1740+ put_link(nd);
1741+ if (likely(!d_is_symlink(path->dentry)) ||
1742+ !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW)) {
1743+ /* not a symlink or should not follow */
1744+ path_to_nameidata(path, nd);
1745+ nd->inode = inode;
1746+ nd->seq = seq;
17411747 return 0;
1748+ }
17421749 /* make sure that d_is_symlink above matches inode */
17431750 if (nd->flags & LOOKUP_RCU) {
1744− if (read_seqcount_retry(&link->dentry->d_seq, seq))
1751+ if (read_seqcount_retry(&path->dentry->d_seq, seq))
17451752 return -ECHILD;
17461753 }
1747− return pick_link(nd, link, inode, seq);
1754+ return pick_link(nd, path, inode, seq);
17481755 }
17491756
1750−enum {WALK_GET = 1, WALK_PUT = 2};
1751−
17521757 static int walk_component(struct nameidata *nd, int flags)
17531758 {
17541759 struct path path;
@@ -1762,7 +1767,7 @@ static int walk_component(struct nameidata *nd, int flags) · 7 unmodified lines
17621767 */
17631768 if (unlikely(nd->last_type != LAST_NORM)) {
17641769 err = handle_dots(nd, nd->last_type);
1765− if (flags & WALK_PUT)
1770+ if (!(flags & WALK_MORE) && nd->depth)
17661771 put_link(nd);
17671772 return err;
17681773 }
@@ -1789,15 +1794,7 @@ static int walk_component(struct nameidata *nd, int flags) · 20 unmodified lines
17891794 inode = d_backing_inode(path.dentry);
17901795 }
17911796
1792− if (flags & WALK_PUT)
1793− put_link(nd);
1794− err = should_follow_link(nd, &path, flags & WALK_GET, inode, seq);
1795− if (unlikely(err))
1796− return err;
1797− path_to_nameidata(&path, nd);
1798− nd->inode = inode;
1799− nd->seq = seq;
1800− return 0;
1797+ return step_into(nd, &path, flags, inode, seq);
18011798 }
18021799
18031800 /*
@@ -2104,9 +2101,10 @@ OK: · 300 unmodified lines
21042101 if (!name)
21052102 return 0;
21062103 /* last component of nested symlink */
2107− err = walk_component(nd, WALK_GET | WALK_PUT);
2104+ err = walk_component(nd, WALK_FOLLOW);
21082105 } else {
2109− err = walk_component(nd, WALK_GET);
2106+ /* not the last component */
2107+ err = walk_component(nd, WALK_FOLLOW | WALK_MORE);
21102108 }
21112109 if (err < 0)
21122110 return err;
@@ -2248,12 +2246,7 @@ static inline int lookup_last(struct nameidata *nd) · 135 unmodified lines
22482246 nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
22492247
22502248 nd->flags &= ~LOOKUP_PARENT;
2251− return walk_component(nd,
2252− nd->flags & LOOKUP_FOLLOW
2253− ? nd->depth
2254− ? WALK_PUT | WALK_GET
2255− : WALK_GET
2256− : 0);
2249+ return walk_component(nd, 0);
22572250 }
22582251
22592252 /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */
@@ -2558,28 +2551,9 @@ int user_path_at_empty(int dfd, const char __user *name, unsigned flags, · 298 unmodified lines
25582551 }
25592552 EXPORT_SYMBOL(user_path_at_empty);
25602553
2561−/*
2562− * NB: most callers don't do anything directly with the reference to the
2563− * to struct filename, but the nd->last pointer points into the name string
2564− * allocated by getname. So we must hold the reference to it until all
2565− * path-walking is complete.
2566− */
2567−static inline struct filename *
2568−user_path_parent(int dfd, const char __user *path,
2569− struct path *parent,
2570− struct qstr *last,
2571− int *type,
2572− unsigned int flags)
2573−{
2574− /* only LOOKUP_REVAL is allowed in extra flags */
2575− return filename_parentat(dfd, getname(path), flags & LOOKUP_REVAL,
2576− parent, last, type);
2577−}
2578−
25792554 /**
25802555 * mountpoint_last - look up last component for umount
25812556 * @nd: pathwalk nameidata - currently pointing at parent directory of "last"
2582− * @path: pointer to container for result
25832557 *
25842558 * This is a special lookup_last function just for umount. In this case, we
25852559 * need to resolve the path without doing any revalidation.
@@ -2592,23 +2566,20 @@ user_path_parent(int dfd, const char __user *path, · 6 unmodified lines
25922566 *
25932567 * Returns:
25942568 * -error: if there was an error during lookup. This includes -ENOENT if the
2595− * lookup found a negative dentry. The nd->path reference will also be
2596− * put in this case.
2569+ * lookup found a negative dentry.
25972570 *
2598− * 0: if we successfully resolved nd->path and found it to not to be a
2599− * symlink that needs to be followed. "path" will also be populated.
2600− * The nd->path reference will also be put.
2571+ * 0: if we successfully resolved nd->last and found it to not to be a
2572+ * symlink that needs to be followed.
26012573 *
26022574 * 1: if we successfully resolved nd->last and found it to be a symlink
2603− * that needs to be followed. "path" will be populated with the path
2604− * to the link, and nd->path will *not* be put.
2575+ * that needs to be followed.
26052576 */
26062577 static int
2607−mountpoint_last(struct nameidata *nd, struct path *path)
2578+mountpoint_last(struct nameidata *nd)
26082579 {
26092580 int error = 0;
2610− struct dentry *dentry;
26112581 struct dentry *dir = nd->path.dentry;
2582+ struct path path;
26122583
26132584 /* If we're in rcuwalk, drop out of it to handle last component */
26142585 if (nd->flags & LOOKUP_RCU) {
@@ -2622,37 +2593,28 @@ mountpoint_last(struct nameidata *nd, struct path *path) · 7 unmodified lines
26222593 error = handle_dots(nd, nd->last_type);
26232594 if (error)
26242595 return error;
2625− dentry = dget(nd->path.dentry);
2596+ path.dentry = dget(nd->path.dentry);
26262597 } else {
2627− dentry = d_lookup(dir, &nd->last);
2628− if (!dentry) {
2598+ path.dentry = d_lookup(dir, &nd->last);
2599+ if (!path.dentry) {
26292600 /*
26302601 * No cached dentry. Mounted dentries are pinned in the
26312602 * cache, so that means that this dentry is probably
26322603 * a symlink or the path doesn't actually point
26332604 * to a mounted dentry.
26342605 */
2635− dentry = lookup_slow(&nd->last, dir,
2606+ path.dentry = lookup_slow(&nd->last, dir,
26362607 nd->flags | LOOKUP_NO_REVAL);
2637− if (IS_ERR(dentry))
2638− return PTR_ERR(dentry);
2608+ if (IS_ERR(path.dentry))
2609+ return PTR_ERR(path.dentry);
26392610 }
26402611 }
2641− if (d_is_negative(dentry)) {
2642− dput(dentry);
2612+ if (d_is_negative(path.dentry)) {
2613+ dput(path.dentry);
26432614 return -ENOENT;
26442615 }
2645− if (nd->depth)
2646− put_link(nd);
2647− path->dentry = dentry;
2648− path->mnt = nd->path.mnt;
2649− error = should_follow_link(nd, path, nd->flags & LOOKUP_FOLLOW,
2650− d_backing_inode(dentry), 0);
2651− if (unlikely(error))
2652− return error;
2653− mntget(path->mnt);
2654− follow_mount(path);
2655− return 0;
2616+ path.mnt = nd->path.mnt;
2617+ return step_into(nd, &path, 0, d_backing_inode(path.dentry), 0);
26562618 }
26572619
26582620 /**
@@ -2672,13 +2634,19 @@ path_mountpoint(struct nameidata *nd, unsigned flags, struct path *path) · 13 unmodified lines
26722634 if (IS_ERR(s))
26732635 return PTR_ERR(s);
26742636 while (!(err = link_path_walk(s, nd)) &&
2675− (err = mountpoint_last(nd, path)) > 0) {
2637+ (err = mountpoint_last(nd)) > 0) {
26762638 s = trailing_symlink(nd);
26772639 if (IS_ERR(s)) {
26782640 err = PTR_ERR(s);
26792641 break;
26802642 }
26812643 }
2644+ if (!err) {
2645+ *path = nd->path;
2646+ nd->path.mnt = NULL;
2647+ nd->path.dentry = NULL;
2648+ follow_mount(path);
2649+ }
26822650 terminate_walk(nd);
26832651 return err;
26842652 }
@@ -3335,18 +3303,11 @@ static int do_last(struct nameidata *nd, · 650 unmodified lines
33353303 seq = 0; /* out of RCU mode, so the value doesn't matter */
33363304 inode = d_backing_inode(path.dentry);
33373305 finish_lookup:
3338− if (nd->depth)
3339− put_link(nd);
3340− error = should_follow_link(nd, &path, nd->flags & LOOKUP_FOLLOW,
3341− inode, seq);
3306+ error = step_into(nd, &path, 0, inode, seq);
33423307 if (unlikely(error))
33433308 return error;
3344−
3345− path_to_nameidata(&path, nd);
3346− nd->inode = inode;
3347− nd->seq = seq;
3348− /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
33493309 finish_open:
3310+ /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
33503311 error = complete_walk(nd);
33513312 if (error)
33523313 return error;
@@ -3861,8 +3822,8 @@ static long do_rmdir(int dfd, const char __user *pathname) · 508 unmodified lines
38613822 int type;
38623823 unsigned int lookup_flags = 0;
38633824 retry:
3864− name = user_path_parent(dfd, pathname,
3865− &path, &last, &type, lookup_flags);
3825+ name = filename_parentat(dfd, getname(pathname), lookup_flags,
3826+ &path, &last, &type);
38663827 if (IS_ERR(name))
38673828 return PTR_ERR(name);
38683829
@@ -3991,8 +3952,8 @@ static long do_unlinkat(int dfd, const char __user *pathname) · 122 unmodified lines
39913952 struct inode *delegated_inode = NULL;
39923953 unsigned int lookup_flags = 0;
39933954 retry:
3994− name = user_path_parent(dfd, pathname,
3995− &path, &last, &type, lookup_flags);
3955+ name = filename_parentat(dfd, getname(pathname), lookup_flags,
3956+ &path, &last, &type);
39963957 if (IS_ERR(name))
39973958 return PTR_ERR(name);
39983959
@@ -4491,15 +4452,15 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, · 492 unmodified lines
44914452 target_flags = 0;
44924453
44934454 retry:
4494− from = user_path_parent(olddfd, oldname,
4495− &old_path, &old_last, &old_type, lookup_flags);
4455+ from = filename_parentat(olddfd, getname(oldname), lookup_flags,
4456+ &old_path, &old_last, &old_type);
44964457 if (IS_ERR(from)) {
44974458 error = PTR_ERR(from);
44984459 goto exit;
44994460 }
45004461
4501− to = user_path_parent(newdfd, newname,
4502− &new_path, &new_last, &new_type, lookup_flags);
4462+ to = filename_parentat(newdfd, getname(newname), lookup_flags,
4463+ &new_path, &new_last, &new_type);
45034464 if (IS_ERR(to)) {
45044465 error = PTR_ERR(to);
45054466 goto exit1;
fs/ncpfs/file.c+1−1
@@ -203,7 +203,7 @@ ncp_file_write_iter(struct kiocb *iocb, struct iov_iter *from) · 202 unmodified lines
203203 bufsize - (pos % bufsize),
204204 iov_iter_count(from));
205205
206− if (copy_from_iter(bouncebuffer, to_write, from) != to_write) {
206+ if (!copy_from_iter_full(bouncebuffer, to_write, from)) {
207207 errno = -EFAULT;
208208 break;
209209 }
fs/orangefs/devorangefs-req.c+4−9
@@ -355,7 +355,6 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, · 354 unmodified lines
355355 __u64 tag;
356356 } head;
357357 int total = ret = iov_iter_count(iter);
358− int n;
359358 int downcall_size = sizeof(struct orangefs_downcall_s);
360359 int head_size = sizeof(head);
361360
@@ -372,8 +371,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, · 10 unmodified lines
372371 return -EFAULT;
373372 }
374373
375− n = copy_from_iter(&head, head_size, iter);
376− if (n < head_size) {
374+ if (!copy_from_iter_full(&head, head_size, iter)) {
377375 gossip_err("%s: failed to copy head.\n", __func__);
378376 return -EFAULT;
379377 }
@@ -407,8 +405,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, · 27 unmodified lines
407405 return ret;
408406 }
409407
410− n = copy_from_iter(&op->downcall, downcall_size, iter);
411− if (n != downcall_size) {
408+ if (!copy_from_iter_full(&op->downcall, downcall_size, iter)) {
412409 gossip_err("%s: failed to copy downcall.\n", __func__);
413410 goto Efault;
414411 }
@@ -462,10 +459,8 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, · 47 unmodified lines
462459 goto Enomem;
463460 }
464461 memset(op->downcall.trailer_buf, 0, op->downcall.trailer_size);
465− n = copy_from_iter(op->downcall.trailer_buf,
466− op->downcall.trailer_size,
467− iter);
468− if (n != op->downcall.trailer_size) {
462+ if (!copy_from_iter_full(op->downcall.trailer_buf,
463+ op->downcall.trailer_size, iter)) {
469464 gossip_err("%s: failed to copy trailer.\n", __func__);
470465 vfree(op->downcall.trailer_buf);
471466 goto Efault;
include/linux/skbuff.h+3−3
@@ -2809,12 +2809,12 @@ static inline int skb_add_data(struct sk_buff *skb, · 2808 unmodified lines
28092809
28102810 if (skb->ip_summed == CHECKSUM_NONE) {
28112811 __wsum csum = 0;
2812− if (csum_and_copy_from_iter(skb_put(skb, copy), copy,
2813− &csum, from) == copy) {
2812+ if (csum_and_copy_from_iter_full(skb_put(skb, copy), copy,
2813+ &csum, from)) {
28142814 skb->csum = csum_block_add(skb->csum, csum, off);
28152815 return 0;
28162816 }
2817− } else if (copy_from_iter(skb_put(skb, copy), copy, from) == copy)
2817+ } else if (copy_from_iter_full(skb_put(skb, copy), copy, from))
28182818 return 0;
28192819
28202820 __skb_trim(skb, off);
include/linux/uio.h+3−0
@@ -89,7 +89,9 @@ size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, · 88 unmodified lines
8989 struct iov_iter *i);
9090 size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i);
9191 size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i);
92+bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i);
9293 size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i);
94+bool copy_from_iter_full_nocache(void *addr, size_t bytes, struct iov_iter *i);
9395 size_t iov_iter_zero(size_t bytes, struct iov_iter *);
9496 unsigned long iov_iter_alignment(const struct iov_iter *i);
9597 unsigned long iov_iter_gap_alignment(const struct iov_iter *i);
@@ -155,6 +157,7 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) · 59 unmodified lines
155157 }
156158 size_t csum_and_copy_to_iter(const void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
157159 size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
160+bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
158161
159162 int import_iovec(int type, const struct iovec __user * uvector,
160163 unsigned nr_segs, unsigned fast_segs,
include/net/sock.h+3−3
@@ -1783,13 +1783,13 @@ static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, · 1782 unmodified lines
17831783 {
17841784 if (skb->ip_summed == CHECKSUM_NONE) {
17851785 __wsum csum = 0;
1786− if (csum_and_copy_from_iter(to, copy, &csum, from) != copy)
1786+ if (!csum_and_copy_from_iter_full(to, copy, &csum, from))
17871787 return -EFAULT;
17881788 skb->csum = csum_block_add(skb->csum, csum, offset);
17891789 } else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) {
1790− if (copy_from_iter_nocache(to, copy, from) != copy)
1790+ if (!copy_from_iter_full_nocache(to, copy, from))
17911791 return -EFAULT;
1792− } else if (copy_from_iter(to, copy, from) != copy)
1792+ } else if (!copy_from_iter_full(to, copy, from))
17931793 return -EFAULT;
17941794
17951795 return 0;
include/net/udplite.h+1−1
@@ -20,7 +20,7 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset, · 19 unmodified lines
2020 int len, int odd, struct sk_buff *skb)
2121 {
2222 struct msghdr *msg = from;
23− return copy_from_iter(to, len, &msg->msg_iter) != len ? -EFAULT : 0;
23+ return copy_from_iter_full(to, len, &msg->msg_iter) ? 0 : -EFAULT;
2424 }
2525
2626 /* Designate sk as UDP-Lite socket */
kernel/printk/printk.c+1−1
@@ -748,7 +748,7 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) · 747 unmodified lines
748748 return -ENOMEM;
749749
750750 buf[len] = '\0';
751− if (copy_from_iter(buf, len, from) != len) {
751+ if (!copy_from_iter_full(buf, len, from)) {
752752 kfree(buf);
753753 return -EFAULT;
754754 }
lib/iov_iter.c+96−2
@@ -568,6 +568,31 @@ size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) · 567 unmodified lines
568568 }
569569 EXPORT_SYMBOL(copy_from_iter);
570570
571+bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
572+{
573+ char *to = addr;
574+ if (unlikely(i->type & ITER_PIPE)) {
575+ WARN_ON(1);
576+ return false;
577+ }
578+ if (unlikely(i->count < bytes)) \
579+ return false;
580+
581+ iterate_all_kinds(i, bytes, v, ({
582+ if (__copy_from_user((to += v.iov_len) - v.iov_len,
583+ v.iov_base, v.iov_len))
584+ return false;
585+ 0;}),
586+ memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
587+ v.bv_offset, v.bv_len),
588+ memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
589+ )
590+
591+ iov_iter_advance(i, bytes);
592+ return true;
593+}
594+EXPORT_SYMBOL(copy_from_iter_full);
595+
571596 size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i)
572597 {
573598 char *to = addr;
@@ -587,6 +612,30 @@ size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i) · 13 unmodified lines
587612 }
588613 EXPORT_SYMBOL(copy_from_iter_nocache);
589614
615+bool copy_from_iter_full_nocache(void *addr, size_t bytes, struct iov_iter *i)
616+{
617+ char *to = addr;
618+ if (unlikely(i->type & ITER_PIPE)) {
619+ WARN_ON(1);
620+ return false;
621+ }
622+ if (unlikely(i->count < bytes)) \
623+ return false;
624+ iterate_all_kinds(i, bytes, v, ({
625+ if (__copy_from_user_nocache((to += v.iov_len) - v.iov_len,
626+ v.iov_base, v.iov_len))
627+ return false;
628+ 0;}),
629+ memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
630+ v.bv_offset, v.bv_len),
631+ memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
632+ )
633+
634+ iov_iter_advance(i, bytes);
635+ return true;
636+}
637+EXPORT_SYMBOL(copy_from_iter_full_nocache);
638+
590639 size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
591640 struct iov_iter *i)
592641 {
@@ -1008,7 +1057,7 @@ size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, · 415 unmodified lines
10081057 }
10091058 iterate_and_advance(i, bytes, v, ({
10101059 int err = 0;
1011− next = csum_and_copy_from_user(v.iov_base,
1060+ next = csum_and_copy_from_user(v.iov_base,
10121061 (to += v.iov_len) - v.iov_len,
10131062 v.iov_len, 0, &err);
10141063 if (!err) {
@@ -1037,6 +1086,51 @@ size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, · 22 unmodified lines
10371086 }
10381087 EXPORT_SYMBOL(csum_and_copy_from_iter);
10391088
1089+bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum,
1090+ struct iov_iter *i)
1091+{
1092+ char *to = addr;
1093+ __wsum sum, next;
1094+ size_t off = 0;
1095+ sum = *csum;
1096+ if (unlikely(i->type & ITER_PIPE)) {
1097+ WARN_ON(1);
1098+ return false;
1099+ }
1100+ if (unlikely(i->count < bytes))
1101+ return false;
1102+ iterate_all_kinds(i, bytes, v, ({
1103+ int err = 0;
1104+ next = csum_and_copy_from_user(v.iov_base,
1105+ (to += v.iov_len) - v.iov_len,
1106+ v.iov_len, 0, &err);
1107+ if (err)
1108+ return false;
1109+ sum = csum_block_add(sum, next, off);
1110+ off += v.iov_len;
1111+ 0;
1112+ }), ({
1113+ char *p = kmap_atomic(v.bv_page);
1114+ next = csum_partial_copy_nocheck(p + v.bv_offset,
1115+ (to += v.bv_len) - v.bv_len,
1116+ v.bv_len, 0);
1117+ kunmap_atomic(p);
1118+ sum = csum_block_add(sum, next, off);
1119+ off += v.bv_len;
1120+ }),({
1121+ next = csum_partial_copy_nocheck(v.iov_base,
1122+ (to += v.iov_len) - v.iov_len,
1123+ v.iov_len, 0);
1124+ sum = csum_block_add(sum, next, off);
1125+ off += v.iov_len;
1126+ })
1127+ )
1128+ *csum = sum;
1129+ iov_iter_advance(i, bytes);
1130+ return true;
1131+}
1132+EXPORT_SYMBOL(csum_and_copy_from_iter_full);
1133+
10401134 size_t csum_and_copy_to_iter(const void *addr, size_t bytes, __wsum *csum,
10411135 struct iov_iter *i)
10421136 {
@@ -1051,7 +1145,7 @@ size_t csum_and_copy_to_iter(const void *addr, size_t bytes, __wsum *csum, · 8 unmodified lines
10511145 iterate_and_advance(i, bytes, v, ({
10521146 int err = 0;
10531147 next = csum_and_copy_to_user((from += v.iov_len) - v.iov_len,
1054− v.iov_base,
1148+ v.iov_base,
10551149 v.iov_len, 0, &err);
10561150 if (!err) {
10571151 sum = csum_block_add(sum, next, off);
net/atm/common.c+1−1
@@ -630,7 +630,7 @@ int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t size) · 629 unmodified lines
630630 goto out;
631631 skb->dev = NULL; /* for paths shared with net_device interfaces */
632632 ATM_SKB(skb)->atm_options = vcc->atm_options;
633− if (copy_from_iter(skb_put(skb, size), size, &m->msg_iter) != size) {
633+ if (!copy_from_iter_full(skb_put(skb, size), size, &m->msg_iter)) {
634634 kfree_skb(skb);
635635 error = -EFAULT;
636636 goto out;
net/bluetooth/l2cap_core.c+3−3
@@ -2127,7 +2127,7 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan, · 2126 unmodified lines
21272127 struct sk_buff **frag;
21282128 int sent = 0;
21292129
2130− if (copy_from_iter(skb_put(skb, count), count, &msg->msg_iter) != count)
2130+ if (!copy_from_iter_full(skb_put(skb, count), count, &msg->msg_iter))
21312131 return -EFAULT;
21322132
21332133 sent += count;
@@ -2147,8 +2147,8 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan, · 13 unmodified lines
21472147
21482148 *frag = tmp;
21492149
2150− if (copy_from_iter(skb_put(*frag, count), count,
2151− &msg->msg_iter) != count)
2150+ if (!copy_from_iter_full(skb_put(*frag, count), count,
2151+ &msg->msg_iter))
21522152 return -EFAULT;
21532153
21542154 sent += count;
net/ipv4/ip_output.c+2−2
@@ -802,11 +802,11 @@ ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk · 801 unmodified lines
802802 struct msghdr *msg = from;
803803
804804 if (skb->ip_summed == CHECKSUM_PARTIAL) {
805− if (copy_from_iter(to, len, &msg->msg_iter) != len)
805+ if (!copy_from_iter_full(to, len, &msg->msg_iter))
806806 return -EFAULT;
807807 } else {
808808 __wsum csum = 0;
809− if (csum_and_copy_from_iter(to, len, &csum, &msg->msg_iter) != len)
809+ if (!csum_and_copy_from_iter_full(to, len, &csum, &msg->msg_iter))
810810 return -EFAULT;
811811 skb->csum = csum_block_add(skb->csum, csum, odd);
812812 }
net/ipv4/ping.c+4−4
@@ -609,15 +609,15 @@ int ping_getfrag(void *from, char *to, · 608 unmodified lines
609609 fraglen -= sizeof(struct icmphdr);
610610 if (fraglen < 0)
611611 BUG();
612− if (csum_and_copy_from_iter(to + sizeof(struct icmphdr),
612+ if (!csum_and_copy_from_iter_full(to + sizeof(struct icmphdr),
613613 fraglen, &pfh->wcheck,
614− &pfh->msg->msg_iter) != fraglen)
614+ &pfh->msg->msg_iter))
615615 return -EFAULT;
616616 } else if (offset < sizeof(struct icmphdr)) {
617617 BUG();
618618 } else {
619− if (csum_and_copy_from_iter(to, fraglen, &pfh->wcheck,
620− &pfh->msg->msg_iter) != fraglen)
619+ if (!csum_and_copy_from_iter_full(to, fraglen, &pfh->wcheck,
620+ &pfh->msg->msg_iter))
621621 return -EFAULT;
622622 }
623623
net/packet/af_packet.c+1−4
@@ -2432,14 +2432,11 @@ static int __packet_snd_vnet_parse(struct virtio_net_hdr *vnet_hdr, size_t len) · 2431 unmodified lines
24322432 static int packet_snd_vnet_parse(struct msghdr *msg, size_t *len,
24332433 struct virtio_net_hdr *vnet_hdr)
24342434 {
2435− int n;
2436−
24372435 if (*len < sizeof(*vnet_hdr))
24382436 return -EINVAL;
24392437 *len -= sizeof(*vnet_hdr);
24402438
2441− n = copy_from_iter(vnet_hdr, sizeof(*vnet_hdr), &msg->msg_iter);
2442− if (n != sizeof(*vnet_hdr))
2439+ if (!copy_from_iter_full(vnet_hdr, sizeof(*vnet_hdr), &msg->msg_iter))
24432440 return -EFAULT;
24442441
24452442 return __packet_snd_vnet_parse(vnet_hdr, *len);
net/tipc/msg.c+2−2
@@ -268,7 +268,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, · 267 unmodified lines
268268 __skb_queue_tail(list, skb);
269269 skb_copy_to_linear_data(skb, mhdr, mhsz);
270270 pktpos = skb->data + mhsz;
271− if (copy_from_iter(pktpos, dsz, &m->msg_iter) == dsz)
271+ if (copy_from_iter_full(pktpos, dsz, &m->msg_iter))
272272 return dsz;
273273 rc = -EFAULT;
274274 goto error;
@@ -299,7 +299,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, · 24 unmodified lines
299299 if (drem < pktrem)
300300 pktrem = drem;
301301
302− if (copy_from_iter(pktpos, pktrem, &m->msg_iter) != pktrem) {
302+ if (!copy_from_iter_full(pktpos, pktrem, &m->msg_iter)) {
303303 rc = -EFAULT;
304304 goto error;
305305 }
security/keys/keyctl.c+1−1
@@ -1074,7 +1074,7 @@ long keyctl_instantiate_key_common(key_serial_t id, · 1073 unmodified lines
10741074 }
10751075
10761076 ret = -EFAULT;
1077− if (copy_from_iter(payload, plen, from) != plen)
1077+ if (!copy_from_iter_full(payload, plen, from))
10781078 goto error2;
10791079 }
10801080

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t