tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git ceph-fscrypt-size head: a17ec2cafbd2fc0e04e8787810bec64849190db2 commit: e1f497d75bf9fea8856174467d488557f8060e28 [33/40] ceph: align data in pages in ceph_sync_write config: i386-randconfig-a006-20210824 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?id=e1f497d75bf9fea8856174467d488557f8060e28 git remote add jlayton https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git git fetch --no-tags jlayton ceph-fscrypt-size git checkout e1f497d75bf9fea8856174467d488557f8060e28 # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from fs/ceph/super.h:29, from fs/ceph/super.c:20: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/super.c:23: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/super.c: In function 'ceph_put_super': >> fs/ceph/super.c:48:2: error: implicit declaration of function 'ceph_fscrypt_free_dummy_policy'; did you mean 'fscrypt_free_dummy_policy'? [-Werror=implicit-function-declaration] 48 | ceph_fscrypt_free_dummy_policy(fsc); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | fscrypt_free_dummy_policy fs/ceph/super.c: In function 'ceph_set_super': >> fs/ceph/super.c:1180:2: error: implicit declaration of function 'ceph_fscrypt_set_ops'; did you mean 'fscrypt_set_ops'? [-Werror=implicit-function-declaration] 1180 | ceph_fscrypt_set_ops(s); | ^~~~~~~~~~~~~~~~~~~~ | fscrypt_set_ops cc1: some warnings being treated as errors -- In file included from fs/ceph/super.h:29, from fs/ceph/inode.c:19: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/inode.c:22: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/inode.c: In function 'ceph_new_inode': >> fs/ceph/inode.c:94:8: error: implicit declaration of function 'ceph_fscrypt_prepare_context' [-Werror=implicit-function-declaration] 94 | err = ceph_fscrypt_prepare_context(dir, inode, as_ctx); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/inode.c: In function 'ceph_as_ctx_to_req': >> fs/ceph/inode.c:110:2: error: implicit declaration of function 'ceph_fscrypt_as_ctx_to_req'; did you mean 'ceph_as_ctx_to_req'? [-Werror=implicit-function-declaration] 110 | ceph_fscrypt_as_ctx_to_req(req, as_ctx); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | ceph_as_ctx_to_req fs/ceph/inode.c: In function 'ceph_fill_trace': >> fs/ceph/inode.c:1466:10: error: implicit declaration of function 'ceph_fname_alloc_buffer'; did you mean 'fscrypt_fname_alloc_buffer'? [-Werror=implicit-function-declaration] 1466 | err = ceph_fname_alloc_buffer(dir, &oname); | ^~~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_alloc_buffer >> fs/ceph/inode.c:1472:10: error: implicit declaration of function 'ceph_fname_to_usr' [-Werror=implicit-function-declaration] 1472 | err = ceph_fname_to_usr(&fname, NULL, &oname, &is_nokey); | ^~~~~~~~~~~~~~~~~ >> fs/ceph/inode.c:1475:5: error: implicit declaration of function 'ceph_fname_free_buffer'; did you mean 'fscrypt_fname_free_buffer'? [-Werror=implicit-function-declaration] 1475 | ceph_fname_free_buffer(dir, &oname); | ^~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_free_buffer cc1: some warnings being treated as errors -- In file included from fs/ceph/super.h:29, from fs/ceph/dir.c:10: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/dir.c:12: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/dir.c: In function 'ceph_readdir': >> fs/ceph/dir.c:372:8: error: implicit declaration of function 'ceph_fname_alloc_buffer'; did you mean 'fscrypt_fname_alloc_buffer'? [-Werror=implicit-function-declaration] 372 | err = ceph_fname_alloc_buffer(inode, &tname); | ^~~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_alloc_buffer >> fs/ceph/dir.c:545:9: error: implicit declaration of function 'ceph_fname_to_usr' [-Werror=implicit-function-declaration] 545 | err = ceph_fname_to_usr(&fname, &tname, &oname, NULL); | ^~~~~~~~~~~~~~~~~ >> fs/ceph/dir.c:618:2: error: implicit declaration of function 'ceph_fname_free_buffer'; did you mean 'fscrypt_fname_free_buffer'? [-Werror=implicit-function-declaration] 618 | ceph_fname_free_buffer(inode, &tname); | ^~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_free_buffer cc1: some warnings being treated as errors -- In file included from fs/ceph/super.h:29, from fs/ceph/export.c:8: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/export.c:10: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/export.c: In function 'ceph_get_name': >> fs/ceph/export.c:568:9: error: implicit declaration of function 'ceph_fname_alloc_buffer'; did you mean 'fscrypt_fname_alloc_buffer'? [-Werror=implicit-function-declaration] 568 | err = ceph_fname_alloc_buffer(dir, &oname); | ^~~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_alloc_buffer >> fs/ceph/export.c:572:9: error: implicit declaration of function 'ceph_fname_to_usr' [-Werror=implicit-function-declaration] 572 | err = ceph_fname_to_usr(&fname, NULL, &oname, NULL); | ^~~~~~~~~~~~~~~~~ >> fs/ceph/export.c:577:3: error: implicit declaration of function 'ceph_fname_free_buffer'; did you mean 'fscrypt_fname_free_buffer'? [-Werror=implicit-function-declaration] 577 | ceph_fname_free_buffer(dir, &oname); | ^~~~~~~~~~~~~~~~~~~~~~ | fscrypt_fname_free_buffer cc1: some warnings being treated as errors -- In file included from fs/ceph/super.h:29, from fs/ceph/caps.c:13: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/caps.c:16: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/caps.c: In function 'ceph_encode_dentry_release': >> fs/ceph/caps.c:4566:15: error: implicit declaration of function 'ceph_encode_encrypted_fname'; did you mean 'ceph_encode_dentry_release'? [-Werror=implicit-function-declaration] 4566 | int ret2 = ceph_encode_encrypted_fname(dir, dentry, *p); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | ceph_encode_dentry_release cc1: some warnings being treated as errors -- In file included from fs/ceph/super.h:29, from fs/ceph/mds_client.c:16: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | In file included from fs/ceph/mds_client.c:17: fs/ceph/crypto.h:6: error: unterminated #ifndef 6 | #ifndef _CEPH_CRYPTO_H | fs/ceph/mds_client.c: In function 'ceph_mdsc_build_path': >> fs/ceph/mds_client.c:2584:11: error: implicit declaration of function 'ceph_encode_encrypted_fname'; did you mean 'ceph_encode_dentry_release'? [-Werror=implicit-function-declaration] 2584 | len = ceph_encode_encrypted_fname(d_inode(parent), cur, buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | ceph_encode_dentry_release fs/ceph/mds_client.c: In function 'encode_mclientrequest_tail': >> fs/ceph/mds_client.c:2731:17: error: implicit declaration of function 'ceph_fscrypt_auth_len' [-Werror=implicit-function-declaration] 2731 | u32 authlen = ceph_fscrypt_auth_len(req->r_fscrypt_auth); | ^~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/ceph_fscrypt_auth_len +2731 fs/ceph/mds_client.c 977c54fbce4178 Jeff Layton 2021-01-14 2498 630f27427d391d Jeff Layton 2020-08-07 2499 /** 630f27427d391d Jeff Layton 2020-08-07 2500 * ceph_mdsc_build_path - build a path string to a given dentry 630f27427d391d Jeff Layton 2020-08-07 2501 * @dentry: dentry to which path should be built 630f27427d391d Jeff Layton 2020-08-07 2502 * @plen: returned length of string 630f27427d391d Jeff Layton 2020-08-07 2503 * @pbase: returned base inode number 630f27427d391d Jeff Layton 2020-08-07 2504 * @for_wire: is this path going to be sent to the MDS? 630f27427d391d Jeff Layton 2020-08-07 2505 * 630f27427d391d Jeff Layton 2020-08-07 2506 * Build a string that represents the path to the dentry. This is mostly called 630f27427d391d Jeff Layton 2020-08-07 2507 * for two different purposes: 2f2dc053404feb Sage Weil 2009-10-06 2508 * 630f27427d391d Jeff Layton 2020-08-07 2509 * 1) we need to build a path string to send to the MDS (for_wire == true) 630f27427d391d Jeff Layton 2020-08-07 2510 * 2) we need a path string for local presentation (e.g. debugfs) (for_wire == false) 630f27427d391d Jeff Layton 2020-08-07 2511 * 630f27427d391d Jeff Layton 2020-08-07 2512 * The path is built in reverse, starting with the dentry. Walk back up toward 630f27427d391d Jeff Layton 2020-08-07 2513 * the root, building the path until the first non-snapped inode is reached (for_wire) 630f27427d391d Jeff Layton 2020-08-07 2514 * or the root inode is reached (!for_wire). 2f2dc053404feb Sage Weil 2009-10-06 2515 * 2f2dc053404feb Sage Weil 2009-10-06 2516 * Encode hidden .snap dirs as a double /, i.e. 2f2dc053404feb Sage Weil 2009-10-06 2517 * foo/.snap/bar -> foo//bar 2f2dc053404feb Sage Weil 2009-10-06 2518 */ 630f27427d391d Jeff Layton 2020-08-07 2519 char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for_wire) 2f2dc053404feb Sage Weil 2009-10-06 2520 { 7797b721db4bdb Jeff Layton 2020-08-05 2521 struct dentry *cur; 7797b721db4bdb Jeff Layton 2020-08-05 2522 struct inode *inode; 2f2dc053404feb Sage Weil 2009-10-06 2523 char *path; f77f21bb28367d Jeff Layton 2019-04-29 2524 int pos; 1b71fe2efa31cd Al Viro 2011-07-16 2525 unsigned seq; 69a10fb3f4b876 Jeff Layton 2019-04-26 2526 u64 base; 2f2dc053404feb Sage Weil 2009-10-06 2527 d37b1d9943d513 Markus Elfring 2017-08-20 2528 if (!dentry) 2f2dc053404feb Sage Weil 2009-10-06 2529 return ERR_PTR(-EINVAL); 2f2dc053404feb Sage Weil 2009-10-06 2530 f77f21bb28367d Jeff Layton 2019-04-29 2531 path = __getname(); d37b1d9943d513 Markus Elfring 2017-08-20 2532 if (!path) 2f2dc053404feb Sage Weil 2009-10-06 2533 return ERR_PTR(-ENOMEM); f77f21bb28367d Jeff Layton 2019-04-29 2534 retry: f77f21bb28367d Jeff Layton 2019-04-29 2535 pos = PATH_MAX - 1; f77f21bb28367d Jeff Layton 2019-04-29 2536 path[pos] = '\0'; f77f21bb28367d Jeff Layton 2019-04-29 2537 f77f21bb28367d Jeff Layton 2019-04-29 2538 seq = read_seqbegin(&rename_lock); 7797b721db4bdb Jeff Layton 2020-08-05 2539 cur = dget(dentry); f77f21bb28367d Jeff Layton 2019-04-29 2540 for (;;) { 630f27427d391d Jeff Layton 2020-08-07 2541 struct dentry *parent; 2f2dc053404feb Sage Weil 2009-10-06 2542 7797b721db4bdb Jeff Layton 2020-08-05 2543 spin_lock(&cur->d_lock); 7797b721db4bdb Jeff Layton 2020-08-05 2544 inode = d_inode(cur); 2f2dc053404feb Sage Weil 2009-10-06 2545 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 104648ad3f2ebe Sage Weil 2010-03-18 2546 dout("build_path path+%d: %p SNAPDIR\n", 7797b721db4bdb Jeff Layton 2020-08-05 2547 pos, cur); 630f27427d391d Jeff Layton 2020-08-07 2548 spin_unlock(&cur->d_lock); 630f27427d391d Jeff Layton 2020-08-07 2549 parent = dget_parent(cur); 630f27427d391d Jeff Layton 2020-08-07 2550 } else if (for_wire && inode && dentry != cur && ceph_snap(inode) == CEPH_NOSNAP) { 7797b721db4bdb Jeff Layton 2020-08-05 2551 spin_unlock(&cur->d_lock); d6b8bd679c9c88 Jeff Layton 2019-05-09 2552 pos++; /* get rid of any prepended '/' */ 2f2dc053404feb Sage Weil 2009-10-06 2553 break; 630f27427d391d Jeff Layton 2020-08-07 2554 } else if (!for_wire || !IS_ENCRYPTED(d_inode(cur->d_parent))) { 7797b721db4bdb Jeff Layton 2020-08-05 2555 pos -= cur->d_name.len; 1b71fe2efa31cd Al Viro 2011-07-16 2556 if (pos < 0) { 7797b721db4bdb Jeff Layton 2020-08-05 2557 spin_unlock(&cur->d_lock); 2f2dc053404feb Sage Weil 2009-10-06 2558 break; 1b71fe2efa31cd Al Viro 2011-07-16 2559 } 7797b721db4bdb Jeff Layton 2020-08-05 2560 memcpy(path + pos, cur->d_name.name, cur->d_name.len); 630f27427d391d Jeff Layton 2020-08-07 2561 spin_unlock(&cur->d_lock); 630f27427d391d Jeff Layton 2020-08-07 2562 parent = dget_parent(cur); 630f27427d391d Jeff Layton 2020-08-07 2563 } else { 630f27427d391d Jeff Layton 2020-08-07 2564 int len, ret; 630f27427d391d Jeff Layton 2020-08-07 2565 char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; 630f27427d391d Jeff Layton 2020-08-07 2566 630f27427d391d Jeff Layton 2020-08-07 2567 /* 630f27427d391d Jeff Layton 2020-08-07 2568 * Proactively copy name into buf, in case we need to present 630f27427d391d Jeff Layton 2020-08-07 2569 * it as-is. 630f27427d391d Jeff Layton 2020-08-07 2570 */ 630f27427d391d Jeff Layton 2020-08-07 2571 memcpy(buf, cur->d_name.name, cur->d_name.len); 630f27427d391d Jeff Layton 2020-08-07 2572 len = cur->d_name.len; 630f27427d391d Jeff Layton 2020-08-07 2573 spin_unlock(&cur->d_lock); 630f27427d391d Jeff Layton 2020-08-07 2574 parent = dget_parent(cur); 630f27427d391d Jeff Layton 2020-08-07 2575 630f27427d391d Jeff Layton 2020-08-07 2576 ret = __fscrypt_prepare_readdir(d_inode(parent)); 630f27427d391d Jeff Layton 2020-08-07 2577 if (ret < 0) { 630f27427d391d Jeff Layton 2020-08-07 2578 dput(parent); 630f27427d391d Jeff Layton 2020-08-07 2579 dput(cur); 630f27427d391d Jeff Layton 2020-08-07 2580 return ERR_PTR(ret); 630f27427d391d Jeff Layton 2020-08-07 2581 } 630f27427d391d Jeff Layton 2020-08-07 2582 630f27427d391d Jeff Layton 2020-08-07 2583 if (fscrypt_has_encryption_key(d_inode(parent))) { 630f27427d391d Jeff Layton 2020-08-07 @2584 len = ceph_encode_encrypted_fname(d_inode(parent), cur, buf); 630f27427d391d Jeff Layton 2020-08-07 2585 if (len < 0) { 630f27427d391d Jeff Layton 2020-08-07 2586 dput(parent); 630f27427d391d Jeff Layton 2020-08-07 2587 dput(cur); 630f27427d391d Jeff Layton 2020-08-07 2588 return ERR_PTR(len); 2f2dc053404feb Sage Weil 2009-10-06 2589 } 630f27427d391d Jeff Layton 2020-08-07 2590 } 630f27427d391d Jeff Layton 2020-08-07 2591 pos -= len; 630f27427d391d Jeff Layton 2020-08-07 2592 if (pos < 0) { 630f27427d391d Jeff Layton 2020-08-07 2593 dput(parent); 630f27427d391d Jeff Layton 2020-08-07 2594 break; 630f27427d391d Jeff Layton 2020-08-07 2595 } 630f27427d391d Jeff Layton 2020-08-07 2596 memcpy(path + pos, buf, len); 630f27427d391d Jeff Layton 2020-08-07 2597 } 630f27427d391d Jeff Layton 2020-08-07 2598 dput(cur); 630f27427d391d Jeff Layton 2020-08-07 2599 cur = parent; f77f21bb28367d Jeff Layton 2019-04-29 2600 f77f21bb28367d Jeff Layton 2019-04-29 2601 /* Are we at the root? */ 7797b721db4bdb Jeff Layton 2020-08-05 2602 if (IS_ROOT(cur)) f77f21bb28367d Jeff Layton 2019-04-29 2603 break; f77f21bb28367d Jeff Layton 2019-04-29 2604 f77f21bb28367d Jeff Layton 2019-04-29 2605 /* Are we out of buffer? */ f77f21bb28367d Jeff Layton 2019-04-29 2606 if (--pos < 0) f77f21bb28367d Jeff Layton 2019-04-29 2607 break; f77f21bb28367d Jeff Layton 2019-04-29 2608 f77f21bb28367d Jeff Layton 2019-04-29 2609 path[pos] = '/'; 2f2dc053404feb Sage Weil 2009-10-06 2610 } 7797b721db4bdb Jeff Layton 2020-08-05 2611 inode = d_inode(cur); 7797b721db4bdb Jeff Layton 2020-08-05 2612 base = inode ? ceph_ino(inode) : 0; 7797b721db4bdb Jeff Layton 2020-08-05 2613 dput(cur); f5946bcc5e7903 Jeff Layton 2019-10-16 2614 f5946bcc5e7903 Jeff Layton 2019-10-16 2615 if (read_seqretry(&rename_lock, seq)) f5946bcc5e7903 Jeff Layton 2019-10-16 2616 goto retry; f5946bcc5e7903 Jeff Layton 2019-10-16 2617 f5946bcc5e7903 Jeff Layton 2019-10-16 2618 if (pos < 0) { f5946bcc5e7903 Jeff Layton 2019-10-16 2619 /* f5946bcc5e7903 Jeff Layton 2019-10-16 2620 * A rename didn't occur, but somehow we didn't end up where f5946bcc5e7903 Jeff Layton 2019-10-16 2621 * we thought we would. Throw a warning and try again. f5946bcc5e7903 Jeff Layton 2019-10-16 2622 */ 630f27427d391d Jeff Layton 2020-08-07 2623 pr_warn("build_path did not end path lookup where expected (pos = %d)\n", pos); 2f2dc053404feb Sage Weil 2009-10-06 2624 goto retry; 2f2dc053404feb Sage Weil 2009-10-06 2625 } 2f2dc053404feb Sage Weil 2009-10-06 2626 69a10fb3f4b876 Jeff Layton 2019-04-26 2627 *pbase = base; f77f21bb28367d Jeff Layton 2019-04-29 2628 *plen = PATH_MAX - 1 - pos; 104648ad3f2ebe Sage Weil 2010-03-18 2629 dout("build_path on %p %d built %llx '%.*s'\n", f77f21bb28367d Jeff Layton 2019-04-29 2630 dentry, d_count(dentry), base, *plen, path + pos); f77f21bb28367d Jeff Layton 2019-04-29 2631 return path + pos; 2f2dc053404feb Sage Weil 2009-10-06 2632 } 2f2dc053404feb Sage Weil 2009-10-06 2633 fd36a71762f3b0 Jeff Layton 2016-12-15 2634 static int build_dentry_path(struct dentry *dentry, struct inode *dir, 2f2dc053404feb Sage Weil 2009-10-06 2635 const char **ppath, int *ppathlen, u64 *pino, 1bcb344086f3ec Jeff Layton 2019-04-15 2636 bool *pfreepath, bool parent_locked) 2f2dc053404feb Sage Weil 2009-10-06 2637 { 2f2dc053404feb Sage Weil 2009-10-06 2638 char *path; 2f2dc053404feb Sage Weil 2009-10-06 2639 c6b0b656ca24ed Jeff Layton 2016-12-15 2640 rcu_read_lock(); fd36a71762f3b0 Jeff Layton 2016-12-15 2641 if (!dir) c6b0b656ca24ed Jeff Layton 2016-12-15 2642 dir = d_inode_rcu(dentry->d_parent); 630f27427d391d Jeff Layton 2020-08-07 2643 if (dir && parent_locked && ceph_snap(dir) == CEPH_NOSNAP && !IS_ENCRYPTED(dir)) { c6b0b656ca24ed Jeff Layton 2016-12-15 2644 *pino = ceph_ino(dir); c6b0b656ca24ed Jeff Layton 2016-12-15 2645 rcu_read_unlock(); 2f2dc053404feb Sage Weil 2009-10-06 2646 *ppath = dentry->d_name.name; 2f2dc053404feb Sage Weil 2009-10-06 2647 *ppathlen = dentry->d_name.len; 2f2dc053404feb Sage Weil 2009-10-06 2648 return 0; 2f2dc053404feb Sage Weil 2009-10-06 2649 } c6b0b656ca24ed Jeff Layton 2016-12-15 2650 rcu_read_unlock(); 2f2dc053404feb Sage Weil 2009-10-06 2651 path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1); 2f2dc053404feb Sage Weil 2009-10-06 2652 if (IS_ERR(path)) 2f2dc053404feb Sage Weil 2009-10-06 2653 return PTR_ERR(path); 2f2dc053404feb Sage Weil 2009-10-06 2654 *ppath = path; 1bcb344086f3ec Jeff Layton 2019-04-15 2655 *pfreepath = true; 2f2dc053404feb Sage Weil 2009-10-06 2656 return 0; 2f2dc053404feb Sage Weil 2009-10-06 2657 } 2f2dc053404feb Sage Weil 2009-10-06 2658 2f2dc053404feb Sage Weil 2009-10-06 2659 static int build_inode_path(struct inode *inode, 2f2dc053404feb Sage Weil 2009-10-06 2660 const char **ppath, int *ppathlen, u64 *pino, 1bcb344086f3ec Jeff Layton 2019-04-15 2661 bool *pfreepath) 2f2dc053404feb Sage Weil 2009-10-06 2662 { 2f2dc053404feb Sage Weil 2009-10-06 2663 struct dentry *dentry; 2f2dc053404feb Sage Weil 2009-10-06 2664 char *path; 2f2dc053404feb Sage Weil 2009-10-06 2665 2f2dc053404feb Sage Weil 2009-10-06 2666 if (ceph_snap(inode) == CEPH_NOSNAP) { 2f2dc053404feb Sage Weil 2009-10-06 2667 *pino = ceph_ino(inode); 2f2dc053404feb Sage Weil 2009-10-06 2668 *ppathlen = 0; 2f2dc053404feb Sage Weil 2009-10-06 2669 return 0; 2f2dc053404feb Sage Weil 2009-10-06 2670 } 2f2dc053404feb Sage Weil 2009-10-06 2671 dentry = d_find_alias(inode); 2f2dc053404feb Sage Weil 2009-10-06 2672 path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1); 2f2dc053404feb Sage Weil 2009-10-06 2673 dput(dentry); 2f2dc053404feb Sage Weil 2009-10-06 2674 if (IS_ERR(path)) 2f2dc053404feb Sage Weil 2009-10-06 2675 return PTR_ERR(path); 2f2dc053404feb Sage Weil 2009-10-06 2676 *ppath = path; 1bcb344086f3ec Jeff Layton 2019-04-15 2677 *pfreepath = true; 2f2dc053404feb Sage Weil 2009-10-06 2678 return 0; 2f2dc053404feb Sage Weil 2009-10-06 2679 } 2f2dc053404feb Sage Weil 2009-10-06 2680 2f2dc053404feb Sage Weil 2009-10-06 2681 /* 2f2dc053404feb Sage Weil 2009-10-06 2682 * request arguments may be specified via an inode *, a dentry *, or 2f2dc053404feb Sage Weil 2009-10-06 2683 * an explicit ino+path. 2f2dc053404feb Sage Weil 2009-10-06 2684 */ 2f2dc053404feb Sage Weil 2009-10-06 2685 static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry, fd36a71762f3b0 Jeff Layton 2016-12-15 2686 struct inode *rdiri, const char *rpath, fd36a71762f3b0 Jeff Layton 2016-12-15 2687 u64 rino, const char **ppath, int *pathlen, 1bcb344086f3ec Jeff Layton 2019-04-15 2688 u64 *ino, bool *freepath, bool parent_locked) 2f2dc053404feb Sage Weil 2009-10-06 2689 { 2f2dc053404feb Sage Weil 2009-10-06 2690 int r = 0; 2f2dc053404feb Sage Weil 2009-10-06 2691 2f2dc053404feb Sage Weil 2009-10-06 2692 if (rinode) { 2f2dc053404feb Sage Weil 2009-10-06 2693 r = build_inode_path(rinode, ppath, pathlen, ino, freepath); 2f2dc053404feb Sage Weil 2009-10-06 2694 dout(" inode %p %llx.%llx\n", rinode, ceph_ino(rinode), 2f2dc053404feb Sage Weil 2009-10-06 2695 ceph_snap(rinode)); 2f2dc053404feb Sage Weil 2009-10-06 2696 } else if (rdentry) { fd36a71762f3b0 Jeff Layton 2016-12-15 2697 r = build_dentry_path(rdentry, rdiri, ppath, pathlen, ino, 1bcb344086f3ec Jeff Layton 2019-04-15 2698 freepath, parent_locked); 2f2dc053404feb Sage Weil 2009-10-06 2699 dout(" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen, 2f2dc053404feb Sage Weil 2009-10-06 2700 *ppath); 795858dbd25346 Sage Weil 2011-08-15 2701 } else if (rpath || rino) { 2f2dc053404feb Sage Weil 2009-10-06 2702 *ino = rino; 2f2dc053404feb Sage Weil 2009-10-06 2703 *ppath = rpath; b000056a5a8d3f David Zafman 2012-10-25 2704 *pathlen = rpath ? strlen(rpath) : 0; 2f2dc053404feb Sage Weil 2009-10-06 2705 dout(" path %.*s\n", *pathlen, rpath); 2f2dc053404feb Sage Weil 2009-10-06 2706 } 2f2dc053404feb Sage Weil 2009-10-06 2707 2f2dc053404feb Sage Weil 2009-10-06 2708 return r; 2f2dc053404feb Sage Weil 2009-10-06 2709 } 2f2dc053404feb Sage Weil 2009-10-06 2710 6f322d1adf7096 Jeff Layton 2021-05-13 2711 static void encode_mclientrequest_tail(void **p, const struct ceph_mds_request *req) 60267ba35c744d Ilya Dryomov 2020-12-16 2712 { 60267ba35c744d Ilya Dryomov 2020-12-16 2713 struct ceph_timespec ts; 60267ba35c744d Ilya Dryomov 2020-12-16 2714 int i; 60267ba35c744d Ilya Dryomov 2020-12-16 2715 60267ba35c744d Ilya Dryomov 2020-12-16 2716 ceph_encode_timespec64(&ts, &req->r_stamp); 60267ba35c744d Ilya Dryomov 2020-12-16 2717 ceph_encode_copy(p, &ts, sizeof(ts)); 60267ba35c744d Ilya Dryomov 2020-12-16 2718 977c54fbce4178 Jeff Layton 2021-01-14 2719 /* v4: gid_list */ 60267ba35c744d Ilya Dryomov 2020-12-16 2720 ceph_encode_32(p, req->r_cred->group_info->ngroups); 60267ba35c744d Ilya Dryomov 2020-12-16 2721 for (i = 0; i < req->r_cred->group_info->ngroups; i++) 60267ba35c744d Ilya Dryomov 2020-12-16 2722 ceph_encode_64(p, from_kgid(&init_user_ns, 60267ba35c744d Ilya Dryomov 2020-12-16 2723 req->r_cred->group_info->gid[i])); 6f322d1adf7096 Jeff Layton 2021-05-13 2724 977c54fbce4178 Jeff Layton 2021-01-14 2725 /* v5: altname */ 977c54fbce4178 Jeff Layton 2021-01-14 2726 ceph_encode_32(p, req->r_altname_len); 977c54fbce4178 Jeff Layton 2021-01-14 2727 ceph_encode_copy(p, req->r_altname, req->r_altname_len); 6f322d1adf7096 Jeff Layton 2021-05-13 2728 6f322d1adf7096 Jeff Layton 2021-05-13 2729 /* v6: fscrypt_auth and fscrypt_file */ 6f322d1adf7096 Jeff Layton 2021-05-13 2730 if (req->r_fscrypt_auth) { 589d14dcb54206 Jeff Layton 2020-09-08 @2731 u32 authlen = ceph_fscrypt_auth_len(req->r_fscrypt_auth); 6f322d1adf7096 Jeff Layton 2021-05-13 2732 6f322d1adf7096 Jeff Layton 2021-05-13 2733 ceph_encode_32(p, authlen); 6f322d1adf7096 Jeff Layton 2021-05-13 2734 ceph_encode_copy(p, req->r_fscrypt_auth, authlen); 6f322d1adf7096 Jeff Layton 2021-05-13 2735 } else { 6f322d1adf7096 Jeff Layton 2021-05-13 2736 ceph_encode_32(p, 0); 6f322d1adf7096 Jeff Layton 2021-05-13 2737 } 6f322d1adf7096 Jeff Layton 2021-05-13 2738 ceph_encode_32(p, 0); // fscrypt_file for now 60267ba35c744d Ilya Dryomov 2020-12-16 2739 } 60267ba35c744d Ilya Dryomov 2020-12-16 2740 :::::: The code at line 2731 was first introduced by commit :::::: 589d14dcb542060a0f1a3c154401c4379339db3c ceph: implement -o test_dummy_encryption mount option :::::: TO: Jeff Layton :::::: CC: Jeff Layton --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org