Skip to content

Commit b4e62aa

Browse files
committed
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
2 parents 8cae8cd + b428081 commit b4e62aa

File tree

4 files changed

+87
-33
lines changed

4 files changed

+87
-33
lines changed

fs/afs/cmservice.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,11 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *);
2929

3030
static int afs_deliver_yfs_cb_callback(struct afs_call *);
3131

32-
#define CM_NAME(name) \
33-
char afs_SRXCB##name##_name[] __tracepoint_string = \
34-
"CB." #name
35-
3632
/*
3733
* CB.CallBack operation type
3834
*/
39-
static CM_NAME(CallBack);
4035
static const struct afs_call_type afs_SRXCBCallBack = {
41-
.name = afs_SRXCBCallBack_name,
36+
.name = "CB.CallBack",
4237
.deliver = afs_deliver_cb_callback,
4338
.destructor = afs_cm_destructor,
4439
.work = SRXAFSCB_CallBack,
@@ -47,9 +42,8 @@ static const struct afs_call_type afs_SRXCBCallBack = {
4742
/*
4843
* CB.InitCallBackState operation type
4944
*/
50-
static CM_NAME(InitCallBackState);
5145
static const struct afs_call_type afs_SRXCBInitCallBackState = {
52-
.name = afs_SRXCBInitCallBackState_name,
46+
.name = "CB.InitCallBackState",
5347
.deliver = afs_deliver_cb_init_call_back_state,
5448
.destructor = afs_cm_destructor,
5549
.work = SRXAFSCB_InitCallBackState,
@@ -58,9 +52,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = {
5852
/*
5953
* CB.InitCallBackState3 operation type
6054
*/
61-
static CM_NAME(InitCallBackState3);
6255
static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
63-
.name = afs_SRXCBInitCallBackState3_name,
56+
.name = "CB.InitCallBackState3",
6457
.deliver = afs_deliver_cb_init_call_back_state3,
6558
.destructor = afs_cm_destructor,
6659
.work = SRXAFSCB_InitCallBackState,
@@ -69,9 +62,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
6962
/*
7063
* CB.Probe operation type
7164
*/
72-
static CM_NAME(Probe);
7365
static const struct afs_call_type afs_SRXCBProbe = {
74-
.name = afs_SRXCBProbe_name,
66+
.name = "CB.Probe",
7567
.deliver = afs_deliver_cb_probe,
7668
.destructor = afs_cm_destructor,
7769
.work = SRXAFSCB_Probe,
@@ -80,9 +72,8 @@ static const struct afs_call_type afs_SRXCBProbe = {
8072
/*
8173
* CB.ProbeUuid operation type
8274
*/
83-
static CM_NAME(ProbeUuid);
8475
static const struct afs_call_type afs_SRXCBProbeUuid = {
85-
.name = afs_SRXCBProbeUuid_name,
76+
.name = "CB.ProbeUuid",
8677
.deliver = afs_deliver_cb_probe_uuid,
8778
.destructor = afs_cm_destructor,
8879
.work = SRXAFSCB_ProbeUuid,
@@ -91,9 +82,8 @@ static const struct afs_call_type afs_SRXCBProbeUuid = {
9182
/*
9283
* CB.TellMeAboutYourself operation type
9384
*/
94-
static CM_NAME(TellMeAboutYourself);
9585
static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
96-
.name = afs_SRXCBTellMeAboutYourself_name,
86+
.name = "CB.TellMeAboutYourself",
9787
.deliver = afs_deliver_cb_tell_me_about_yourself,
9888
.destructor = afs_cm_destructor,
9989
.work = SRXAFSCB_TellMeAboutYourself,
@@ -102,9 +92,8 @@ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
10292
/*
10393
* YFS CB.CallBack operation type
10494
*/
105-
static CM_NAME(YFS_CallBack);
10695
static const struct afs_call_type afs_SRXYFSCB_CallBack = {
107-
.name = afs_SRXCBYFS_CallBack_name,
96+
.name = "YFSCB.CallBack",
10897
.deliver = afs_deliver_yfs_cb_callback,
10998
.destructor = afs_cm_destructor,
11099
.work = SRXAFSCB_CallBack,

fs/afs/dir.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ static int afs_do_lookup_one(struct inode *dir, struct dentry *dentry,
656656
return ret;
657657
}
658658

659-
ret = -ENOENT;
660659
if (!cookie.found) {
661660
_leave(" = -ENOENT [not found]");
662661
return -ENOENT;
@@ -2020,17 +2019,20 @@ static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
20202019

20212020
if (d_count(new_dentry) > 2) {
20222021
/* copy the target dentry's name */
2023-
ret = -ENOMEM;
20242022
op->rename.tmp = d_alloc(new_dentry->d_parent,
20252023
&new_dentry->d_name);
2026-
if (!op->rename.tmp)
2024+
if (!op->rename.tmp) {
2025+
op->error = -ENOMEM;
20272026
goto error;
2027+
}
20282028

20292029
ret = afs_sillyrename(new_dvnode,
20302030
AFS_FS_I(d_inode(new_dentry)),
20312031
new_dentry, op->key);
2032-
if (ret)
2032+
if (ret) {
2033+
op->error = ret;
20332034
goto error;
2035+
}
20342036

20352037
op->dentry_2 = op->rename.tmp;
20362038
op->rename.rehash = NULL;

fs/afs/write.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -771,14 +771,20 @@ int afs_writepages(struct address_space *mapping,
771771
if (wbc->range_cyclic) {
772772
start = mapping->writeback_index * PAGE_SIZE;
773773
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+
}
778784
} else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) {
779785
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;
782788
} else {
783789
ret = afs_writepages_region(mapping, wbc,
784790
wbc->range_start, wbc->range_end, &next);

include/trace/events/afs.h

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,34 @@ enum afs_vl_operation {
174174
afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */
175175
};
176176

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+
177205
enum afs_edit_dir_op {
178206
afs_edit_dir_create,
179207
afs_edit_dir_create_error,
@@ -436,6 +464,32 @@ enum afs_cb_break_reason {
436464
EM(afs_YFSVL_GetCellName, "YFSVL.GetCellName") \
437465
E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
438466

467+
#define afs_cm_operations \
468+
EM(afs_CB_CallBack, "CB.CallBack") \
469+
EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \
470+
EM(afs_CB_Probe, "CB.Probe") \
471+
EM(afs_CB_GetLock, "CB.GetLock") \
472+
EM(afs_CB_GetCE, "CB.GetCE") \
473+
EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \
474+
EM(afs_CB_GetXStats, "CB.GetXStats") \
475+
EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \
476+
E_(afs_CB_ProbeUuid, "CB.ProbeUuid")
477+
478+
#define yfs_cm_operations \
479+
EM(yfs_CB_Probe, "YFSCB.Probe") \
480+
EM(yfs_CB_GetLock, "YFSCB.GetLock") \
481+
EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \
482+
EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \
483+
EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \
484+
EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \
485+
EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \
486+
EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \
487+
EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \
488+
EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \
489+
EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \
490+
EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \
491+
E_(yfs_CB_CallBack, "YFSCB.CallBack")
492+
439493
#define afs_edit_dir_ops \
440494
EM(afs_edit_dir_create, "create") \
441495
EM(afs_edit_dir_create_error, "c_fail") \
@@ -569,6 +623,8 @@ afs_server_traces;
569623
afs_cell_traces;
570624
afs_fs_operations;
571625
afs_vl_operations;
626+
afs_cm_operations;
627+
yfs_cm_operations;
572628
afs_edit_dir_ops;
573629
afs_edit_dir_reasons;
574630
afs_eproto_causes;
@@ -649,20 +705,21 @@ TRACE_EVENT(afs_cb_call,
649705

650706
TP_STRUCT__entry(
651707
__field(unsigned int, call )
652-
__field(const char *, name )
653708
__field(u32, op )
709+
__field(u16, service_id )
654710
),
655711

656712
TP_fast_assign(
657713
__entry->call = call->debug_id;
658-
__entry->name = call->type->name;
659714
__entry->op = call->operation_ID;
715+
__entry->service_id = call->service_id;
660716
),
661717

662-
TP_printk("c=%08x %s o=%u",
718+
TP_printk("c=%08x %s",
663719
__entry->call,
664-
__entry->name,
665-
__entry->op)
720+
__entry->service_id == 2501 ?
721+
__print_symbolic(__entry->op, yfs_cm_operations) :
722+
__print_symbolic(__entry->op, afs_cm_operations))
666723
);
667724

668725
TRACE_EVENT(afs_call,

0 commit comments

Comments
 (0)