-EBADF is a rather confusing error if an operations is not supported, and nfsd gets rather upset about it.
Unified · Split
| @@ -1533,10 +1533,12 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in, · 1532 unmodified lines | ||
| 1533 | 1533 | |
| 1534 | 1534 | if (!(file_in->f_mode & FMODE_READ) || |
| 1535 | 1535 | !(file_out->f_mode & FMODE_WRITE) || |
| 1536 | − (file_out->f_flags & O_APPEND) || | |
| 1537 | − !file_in->f_op->clone_file_range) | |
| 1536 | + (file_out->f_flags & O_APPEND)) | |
| 1538 | 1537 | return -EBADF; |
| 1539 | 1538 | |
| 1539 | + if (!file_in->f_op->clone_file_range) | |
| 1540 | + return -EOPNOTSUPP; | |
| 1541 | + | |
| 1540 | 1542 | ret = clone_verify_area(file_in, pos_in, len, false); |
| 1541 | 1543 | if (ret) |
| 1542 | 1544 | return ret; |