Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'afs-fixes-20210721' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull AFS fixes from David Howells:

- Fix a tracepoint that causes one of the tracing subsystem query files
to crash if the module is loaded

- Fix afs_writepages() to take account of whether the storage rpc
actually succeeded when updating the cyclic writeback counter

- Fix some error code propagation/handling

- Fix place where afs_writepages() was setting writeback_index to a
file position rather than a page index

* tag 'afs-fixes-20210721' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
afs: Remove redundant assignment to ret
afs: Fix setting of writeback_index
afs: check function return
afs: Fix tracepoint string placement with built-in AFS

+87 -33
+7 -18
fs/afs/cmservice.c
··· 29 29 30 30 static int afs_deliver_yfs_cb_callback(struct afs_call *); 31 31 32 - #define CM_NAME(name) \ 33 - char afs_SRXCB##name##_name[] __tracepoint_string = \ 34 - "CB." #name 35 - 36 32 /* 37 33 * CB.CallBack operation type 38 34 */ 39 - static CM_NAME(CallBack); 40 35 static const struct afs_call_type afs_SRXCBCallBack = { 41 - .name = afs_SRXCBCallBack_name, 36 + .name = "CB.CallBack", 42 37 .deliver = afs_deliver_cb_callback, 43 38 .destructor = afs_cm_destructor, 44 39 .work = SRXAFSCB_CallBack, ··· 42 47 /* 43 48 * CB.InitCallBackState operation type 44 49 */ 45 - static CM_NAME(InitCallBackState); 46 50 static const struct afs_call_type afs_SRXCBInitCallBackState = { 47 - .name = afs_SRXCBInitCallBackState_name, 51 + .name = "CB.InitCallBackState", 48 52 .deliver = afs_deliver_cb_init_call_back_state, 49 53 .destructor = afs_cm_destructor, 50 54 .work = SRXAFSCB_InitCallBackState, ··· 52 58 /* 53 59 * CB.InitCallBackState3 operation type 54 60 */ 55 - static CM_NAME(InitCallBackState3); 56 61 static const struct afs_call_type afs_SRXCBInitCallBackState3 = { 57 - .name = afs_SRXCBInitCallBackState3_name, 62 + .name = "CB.InitCallBackState3", 58 63 .deliver = afs_deliver_cb_init_call_back_state3, 59 64 .destructor = afs_cm_destructor, 60 65 .work = SRXAFSCB_InitCallBackState, ··· 62 69 /* 63 70 * CB.Probe operation type 64 71 */ 65 - static CM_NAME(Probe); 66 72 static const struct afs_call_type afs_SRXCBProbe = { 67 - .name = afs_SRXCBProbe_name, 73 + .name = "CB.Probe", 68 74 .deliver = afs_deliver_cb_probe, 69 75 .destructor = afs_cm_destructor, 70 76 .work = SRXAFSCB_Probe, ··· 72 80 /* 73 81 * CB.ProbeUuid operation type 74 82 */ 75 - static CM_NAME(ProbeUuid); 76 83 static const struct afs_call_type afs_SRXCBProbeUuid = { 77 - .name = afs_SRXCBProbeUuid_name, 84 + .name = "CB.ProbeUuid", 78 85 .deliver = afs_deliver_cb_probe_uuid, 79 86 .destructor = afs_cm_destructor, 80 87 .work = SRXAFSCB_ProbeUuid, ··· 82 91 /* 83 92 * CB.TellMeAboutYourself operation type 84 93 */ 85 - static CM_NAME(TellMeAboutYourself); 86 94 static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { 87 - .name = afs_SRXCBTellMeAboutYourself_name, 95 + .name = "CB.TellMeAboutYourself", 88 96 .deliver = afs_deliver_cb_tell_me_about_yourself, 89 97 .destructor = afs_cm_destructor, 90 98 .work = SRXAFSCB_TellMeAboutYourself, ··· 92 102 /* 93 103 * YFS CB.CallBack operation type 94 104 */ 95 - static CM_NAME(YFS_CallBack); 96 105 static const struct afs_call_type afs_SRXYFSCB_CallBack = { 97 - .name = afs_SRXCBYFS_CallBack_name, 106 + .name = "YFSCB.CallBack", 98 107 .deliver = afs_deliver_yfs_cb_callback, 99 108 .destructor = afs_cm_destructor, 100 109 .work = SRXAFSCB_CallBack,
+6 -4
fs/afs/dir.c
··· 656 656 return ret; 657 657 } 658 658 659 - ret = -ENOENT; 660 659 if (!cookie.found) { 661 660 _leave(" = -ENOENT [not found]"); 662 661 return -ENOENT; ··· 2019 2020 2020 2021 if (d_count(new_dentry) > 2) { 2021 2022 /* copy the target dentry's name */ 2022 - ret = -ENOMEM; 2023 2023 op->rename.tmp = d_alloc(new_dentry->d_parent, 2024 2024 &new_dentry->d_name); 2025 - if (!op->rename.tmp) 2025 + if (!op->rename.tmp) { 2026 + op->error = -ENOMEM; 2026 2027 goto error; 2028 + } 2027 2029 2028 2030 ret = afs_sillyrename(new_dvnode, 2029 2031 AFS_FS_I(d_inode(new_dentry)), 2030 2032 new_dentry, op->key); 2031 - if (ret) 2033 + if (ret) { 2034 + op->error = ret; 2032 2035 goto error; 2036 + } 2033 2037 2034 2038 op->dentry_2 = op->rename.tmp; 2035 2039 op->rename.rehash = NULL;
+12 -6
fs/afs/write.c
··· 771 771 if (wbc->range_cyclic) { 772 772 start = mapping->writeback_index * PAGE_SIZE; 773 773 ret = afs_writepages_region(mapping, wbc, start, LLONG_MAX, &next); 774 - if (start > 0 && wbc->nr_to_write > 0 && ret == 0) 775 - ret = afs_writepages_region(mapping, wbc, 0, start, 776 - &next); 777 - mapping->writeback_index = next / PAGE_SIZE; 774 + if (ret == 0) { 775 + mapping->writeback_index = next / PAGE_SIZE; 776 + if (start > 0 && wbc->nr_to_write > 0) { 777 + ret = afs_writepages_region(mapping, wbc, 0, 778 + start, &next); 779 + if (ret == 0) 780 + mapping->writeback_index = 781 + next / PAGE_SIZE; 782 + } 783 + } 778 784 } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) { 779 785 ret = afs_writepages_region(mapping, wbc, 0, LLONG_MAX, &next); 780 - if (wbc->nr_to_write > 0) 781 - mapping->writeback_index = next; 786 + if (wbc->nr_to_write > 0 && ret == 0) 787 + mapping->writeback_index = next / PAGE_SIZE; 782 788 } else { 783 789 ret = afs_writepages_region(mapping, wbc, 784 790 wbc->range_start, wbc->range_end, &next);
+62 -5
include/trace/events/afs.h
··· 174 174 afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */ 175 175 }; 176 176 177 + enum afs_cm_operation { 178 + afs_CB_CallBack = 204, /* AFS break callback promises */ 179 + afs_CB_InitCallBackState = 205, /* AFS initialise callback state */ 180 + afs_CB_Probe = 206, /* AFS probe client */ 181 + afs_CB_GetLock = 207, /* AFS get contents of CM lock table */ 182 + afs_CB_GetCE = 208, /* AFS get cache file description */ 183 + afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */ 184 + afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */ 185 + afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */ 186 + afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */ 187 + }; 188 + 189 + enum yfs_cm_operation { 190 + yfs_CB_Probe = 206, /* YFS probe client */ 191 + yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */ 192 + yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */ 193 + yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */ 194 + yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */ 195 + yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */ 196 + yfs_CB_GetServerPrefs = 215, 197 + yfs_CB_GetCellServDV = 216, 198 + yfs_CB_GetLocalCell = 217, 199 + yfs_CB_GetCacheConfig = 218, 200 + yfs_CB_GetCellByNum = 65537, 201 + yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */ 202 + yfs_CB_CallBack = 64204, 203 + }; 204 + 177 205 enum afs_edit_dir_op { 178 206 afs_edit_dir_create, 179 207 afs_edit_dir_create_error, ··· 464 436 EM(afs_YFSVL_GetCellName, "YFSVL.GetCellName") \ 465 437 E_(afs_VL_GetCapabilities, "VL.GetCapabilities") 466 438 439 + #define afs_cm_operations \ 440 + EM(afs_CB_CallBack, "CB.CallBack") \ 441 + EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \ 442 + EM(afs_CB_Probe, "CB.Probe") \ 443 + EM(afs_CB_GetLock, "CB.GetLock") \ 444 + EM(afs_CB_GetCE, "CB.GetCE") \ 445 + EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \ 446 + EM(afs_CB_GetXStats, "CB.GetXStats") \ 447 + EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \ 448 + E_(afs_CB_ProbeUuid, "CB.ProbeUuid") 449 + 450 + #define yfs_cm_operations \ 451 + EM(yfs_CB_Probe, "YFSCB.Probe") \ 452 + EM(yfs_CB_GetLock, "YFSCB.GetLock") \ 453 + EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \ 454 + EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \ 455 + EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \ 456 + EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \ 457 + EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \ 458 + EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \ 459 + EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \ 460 + EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \ 461 + EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \ 462 + EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \ 463 + E_(yfs_CB_CallBack, "YFSCB.CallBack") 464 + 467 465 #define afs_edit_dir_ops \ 468 466 EM(afs_edit_dir_create, "create") \ 469 467 EM(afs_edit_dir_create_error, "c_fail") \ ··· 623 569 afs_cell_traces; 624 570 afs_fs_operations; 625 571 afs_vl_operations; 572 + afs_cm_operations; 573 + yfs_cm_operations; 626 574 afs_edit_dir_ops; 627 575 afs_edit_dir_reasons; 628 576 afs_eproto_causes; ··· 705 649 706 650 TP_STRUCT__entry( 707 651 __field(unsigned int, call ) 708 - __field(const char *, name ) 709 652 __field(u32, op ) 653 + __field(u16, service_id ) 710 654 ), 711 655 712 656 TP_fast_assign( 713 657 __entry->call = call->debug_id; 714 - __entry->name = call->type->name; 715 658 __entry->op = call->operation_ID; 659 + __entry->service_id = call->service_id; 716 660 ), 717 661 718 - TP_printk("c=%08x %s o=%u", 662 + TP_printk("c=%08x %s", 719 663 __entry->call, 720 - __entry->name, 721 - __entry->op) 664 + __entry->service_id == 2501 ? 665 + __print_symbolic(__entry->op, yfs_cm_operations) : 666 + __print_symbolic(__entry->op, afs_cm_operations)) 722 667 ); 723 668 724 669 TRACE_EVENT(afs_call,