tree:
https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git ceph-fscrypt
head: 6b3ebb239173120d2d62579b9d2a27a24c444a45
commit: 6b3ebb239173120d2d62579b9d2a27a24c444a45 [39/39] WIP: ceph add read/modify/write
config: ia64-randconfig-s032-20210209 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
#
https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/...
git remote add jlayton
https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git
git fetch --no-tags jlayton ceph-fscrypt
git checkout 6b3ebb239173120d2d62579b9d2a27a24c444a45
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:154,
from include/linux/pgtable.h:6,
from arch/ia64/include/asm/uaccess.h:40,
from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/namei.h:5,
from fs/ceph/file.c:10:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:41: warning: variable 'old_rr4' set but
not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
In file included from <command-line>:
fs/ceph/file.c: At top level:
include/linux/compiler_types.h:298:2: error: expected identifier or '(' before
'do'
298 | do { \
| ^~
include/linux/compiler_types.h:308:2: note: in expansion of macro
'__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro
'_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro
'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
fs/ceph/file.c:27:1: note: in expansion of macro 'BUILD_BUG_ON'
27 | BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT);
| ^~~~~~~~~~~~
include/linux/compiler_types.h:302:4: error: expected identifier or '(' before
'while'
302 | } while (0)
| ^~~~~
include/linux/compiler_types.h:308:2: note: in expansion of macro
'__compiletime_assert'
308 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro
'_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro
'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
fs/ceph/file.c:27:1: note: in expansion of macro 'BUILD_BUG_ON'
27 | BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT);
| ^~~~~~~~~~~~
fs/ceph/file.c: In function 'ceph_sync_read':
fs/ceph/file.c:927:37: error: invalid type argument of unary '*' (have
'u64' {aka 'long long unsigned int'})
927 | fscrypt_adjust_off_and_len(inode, *read_off, *read_len);
| ^~~~~~~~~
fs/ceph/file.c:927:48: error: invalid type argument of unary '*' (have
'u64' {aka 'long long unsigned int'})
927 | fscrypt_adjust_off_and_len(inode, *read_off, *read_len);
| ^~~~~~~~~
fs/ceph/file.c: In function 'ceph_sync_write':
> fs/ceph/file.c:1518:14: error: 'struct ceph_inode_info'
has no member named 'vino'; did you mean 'i_vino'?
1518 |
ci->vino, pos, &len, 0, 1,
| ^~~~
| i_vino
> fs/ceph/file.c:1532:14: error: 'write_off' undeclared
(first use in this function); did you mean 'write_len'?
1532 |
page_off = write_off & ~PAGE_MASK;
| ^~~~~~~~~
| write_len
fs/ceph/file.c:1532:14: note: each undeclared identifier is reported only once for each
function it appears in
> fs/ceph/file.c:1548:33: error: 'osdc' undeclared (first
use in this function)
1548 | rreq = ceph_osdc_new_request(osdc,
&ci->i_layout,
| ^~~~
> fs/ceph/file.c:1560:38: error: passing argument 1 of
'osd_req_op_extent_osd_data_pages' from incompatible pointer type
[-Werror=incompatible-pointer-types]
1560 |
osd_req_op_extent_osd_data_pages(rreq, 0, pages,
| ^~~~
| |
| struct ceph_osdc_new_request *
In file included from include/linux/ceph/libceph.h:24,
from fs/ceph/super.h:22,
from fs/ceph/file.c:16:
include/linux/ceph/osd_client.h:442:46: note: expected 'struct ceph_osd_request
*' but argument is of type 'struct ceph_osdc_new_request *'
442 | extern void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
> fs/ceph/file.c:1566:3: error: expected expression before
'}' token
1566 | }
| ^
cc1: some warnings being treated as errors
vim +1518 fs/ceph/file.c
1455
1456 /*
1457 * Synchronous write, straight from __user pointer or user pages.
1458 *
1459 * If write spans object boundary, just do multiple writes. (For a
1460 * correct atomic write, we should e.g. take write locks on all
1461 * objects, rollback on failure, etc.)
1462 */
1463 static ssize_t
1464 ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
1465 struct ceph_snap_context *snapc)
1466 {
1467 struct file *file = iocb->ki_filp;
1468 struct inode *inode = file_inode(file);
1469 struct ceph_inode_info *ci = ceph_inode(inode);
1470 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
1471 struct ceph_osd_request *req;
1472 struct page **pages;
1473 u64 len;
1474 int num_pages;
1475 int written = 0;
1476 int flags;
1477 int ret;
1478 bool check_caps = false;
1479 struct timespec64 mtime = current_time(inode);
1480 size_t count = iov_iter_count(from);
1481 size_t off;
1482
1483 if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
1484 return -EROFS;
1485
1486 dout("sync_write on file %p %lld~%u snapc %p seq %lld\n",
1487 file, pos, (unsigned)count, snapc, snapc->seq);
1488
1489 ret = filemap_write_and_wait_range(inode->i_mapping,
1490 pos, pos + count - 1);
1491 if (ret < 0)
1492 return ret;
1493
1494 ret = invalidate_inode_pages2_range(inode->i_mapping,
1495 pos >> PAGE_SHIFT,
1496 (pos + count - 1) >> PAGE_SHIFT);
1497 if (ret < 0)
1498 dout("invalidate_inode_pages2_range returned %d\n", ret);
1499
1500 flags = /* CEPH_OSD_FLAG_ORDERSNAP | */ CEPH_OSD_FLAG_WRITE;
1501
1502 /* FIXME: temporary hack until we can do a proper RMW cycle */
1503 if (IS_ENCRYPTED(inode)) {
1504 len = iov_iter_count(from);
1505 if ((pos & ~CEPH_FSCRYPT_BLOCK_MASK) || (len &
~CEPH_FSCRYPT_BLOCK_MASK))
1506 return -EINVAL;
1507 }
1508
1509 while ((len = iov_iter_count(from)) > 0) {
1510 size_t left;
1511 size_t page_off;
1512 int n;
1513 u64 baseblock = pos >> CEPH_FSCRYPT_BLOCK_SHIFT;
1514 u64 write_pos = pos;
1515 u64 write_len;
1516
1517 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
1518 ci->vino, pos, &len, 0, 1,
1519
CEPH_OSD_OP_WRITE, flags, snapc,
1520 ci->i_truncate_seq,
1521 ci->i_truncate_size,
1522 false);
1523 if (IS_ERR(req)) {
1524 ret = PTR_ERR(req);
1525 break;
1526 }
1527
1528 write_len = len;
1529 fscrypt_adjust_off_and_len(inode, &write_pos, &write_len);
1530
1531 num_pages = calc_pages_for(write_pos, write_len);
1532 page_off = write_off & ~PAGE_MASK;
1533 pages =
ceph_alloc_page_vector(num_pages, GFP_KERNEL);
1534 if (IS_ERR(pages)) {
1535 ret = PTR_ERR(pages);
1536 goto out;
1537 }
1538
1539 /* Do we need to preload the pages? */
1540 if (pos != write_pos || len != write_len) {
1541 struct ceph_osdc_new_request *rreq;
1542 u64 read_off = write_off;
1543 u64 read_len = write_len;
1544
1545 /* We should only need to do this for encrypted inodes */
1546 WARN_ON_ONCE(!IS_ENCRYPTED(inode));
1547
1548 rreq = ceph_osdc_new_request(osdc, &ci->i_layout,
1549 ci->i_vino, read_off, &read_len, 0, 1,
1550 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
1551 NULL, ci->i_truncate_seq,
1552 ci->i_truncate_size, false);
1553 if (IS_ERR(rreq)) {
1554 ret = PTR_ERR(rreq);
1555 break;
1556 }
1557
1558 /* Add extent for first block? */
1559 if (pos != write_pos)
1560 osd_req_op_extent_osd_data_pages(rreq, 0, pages,
1561 CEPH_FSCRYPT_BLOCK_SIZE,
1562 page_off, false, false);
1563
1564 /* Add extent for last block */
1565 if (len != write_len)
1566 }
1567
1568 left = len;
1569 off = pos & ~CEPH_FSCRYPT_BLOCK_MASK;
1570 for (n = 0; n < num_pages; n++) {
1571 size_t plen = min_t(size_t, left, CEPH_FSCRYPT_BLOCK_SIZE - off);
1572 ret = copy_page_from_iter(pages[n], off, plen, from);
1573 off = 0;
1574 if (ret != plen) {
1575 ret = -EFAULT;
1576 break;
1577 }
1578 left -= ret;
1579 if (IS_ENCRYPTED(inode)) {
1580 ret = fscrypt_encrypt_block_inplace(inode, pages[n],
1581 CEPH_FSCRYPT_BLOCK_SIZE, 0,
1582 baseblock + n, GFP_KERNEL);
1583 if (ret)
1584 break;
1585 }
1586 }
1587
1588 if (ret < 0) {
1589 ceph_release_page_vector(pages, num_pages);
1590 goto out;
1591 }
1592
1593 req->r_inode = inode;
1594
1595 osd_req_op_extent_osd_data_pages(req, 0, pages, len,
1596 pos & ~CEPH_FSCRYPT_BLOCK_MASK,
1597 false, true);
1598
1599 req->r_mtime = mtime;
1600 ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
1601 if (!ret)
1602 ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
1603
1604 ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
1605 req->r_end_latency, ret);
1606 out:
1607 ceph_osdc_put_request(req);
1608 if (ret != 0) {
1609 ceph_set_error_write(ci);
1610 break;
1611 }
1612
1613 ceph_clear_error_write(ci);
1614 pos += len;
1615 written += len;
1616 if (pos > i_size_read(inode)) {
1617 check_caps = ceph_inode_set_size(inode, pos);
1618 if (check_caps)
1619 ceph_check_caps(ceph_inode(inode),
1620 CHECK_CAPS_AUTHONLY,
1621 NULL);
1622 }
1623
1624 }
1625
1626 if (ret != -EOLDSNAPC && written > 0) {
1627 ret = written;
1628 iocb->ki_pos = pos;
1629 }
1630 return ret;
1631 }
1632
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org