Skip to content

Commit 6fb55f9

Browse files
committed
Merge: afs and rxrpc fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/356 JIRA: https://issues.redhat.com/browse/RHEL-78388 Signed-off-by: Marc Dionne <mdionne@redhat.com> Approved-by: Alice Mitchell <ajmitchell@redhat.com> Approved-by: David Howells <dhowells@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 6259575 + f560856 commit 6fb55f9

File tree

14 files changed

+61
-30
lines changed

14 files changed

+61
-30
lines changed

fs/afs/addr_prefs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,10 @@ int afs_proc_addr_prefs_write(struct file *file, char *buf, size_t size)
413413

414414
do {
415415
argc = afs_split_string(&buf, argv, ARRAY_SIZE(argv));
416-
if (argc < 0)
417-
return argc;
416+
if (argc < 0) {
417+
ret = argc;
418+
goto done;
419+
}
418420
if (argc < 2)
419421
goto inval;
420422

fs/afs/afs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <linux/in.h>
1212

13-
#define AFS_MAXCELLNAME 256 /* Maximum length of a cell name */
13+
#define AFS_MAXCELLNAME 253 /* Maximum length of a cell name (DNS limited) */
1414
#define AFS_MAXVOLNAME 64 /* Maximum length of a volume name */
1515
#define AFS_MAXNSERVERS 8 /* Maximum servers in a basic volume record */
1616
#define AFS_NMAXNSERVERS 13 /* Maximum servers in a N/U-class volume record */

fs/afs/afs_vl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define AFS_VL_PORT 7003 /* volume location service port */
1414
#define VL_SERVICE 52 /* RxRPC service ID for the Volume Location service */
1515
#define YFS_VL_SERVICE 2503 /* Service ID for AuriStor upgraded VL service */
16+
#define YFS_VL_MAXCELLNAME 256 /* Maximum length of a cell name in YFS protocol */
1617

1718
enum AFSVL_Operations {
1819
VLGETENTRYBYID = 503, /* AFS Get VLDB entry by ID */

fs/afs/dir.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
14721472
op->file[1].vnode = vnode;
14731473
}
14741474

1475-
return afs_do_sync_operation(op);
1475+
ret = afs_do_sync_operation(op);
1476+
1477+
/* Not all systems that can host afs servers have ENOTEMPTY. */
1478+
if (ret == -EEXIST)
1479+
ret = -ENOTEMPTY;
1480+
return ret;
14761481

14771482
error:
14781483
return afs_put_operation(op);

fs/afs/internal.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,15 @@ extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
13461346
extern int afs_extract_data(struct afs_call *, bool);
13471347
extern int afs_protocol_error(struct afs_call *, enum afs_eproto_cause);
13481348

1349+
static inline void afs_see_call(struct afs_call *call, enum afs_call_trace why)
1350+
{
1351+
int r = refcount_read(&call->ref);
1352+
1353+
trace_afs_call(call->debug_id, why, r,
1354+
atomic_read(&call->net->nr_outstanding_calls),
1355+
__builtin_return_address(0));
1356+
}
1357+
13491358
static inline void afs_make_op_call(struct afs_operation *op, struct afs_call *call,
13501359
gfp_t gfp)
13511360
{

fs/afs/rxrpc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,16 @@ void afs_make_call(struct afs_call *call, gfp_t gfp)
430430
return;
431431

432432
error_do_abort:
433-
if (ret != -ECONNABORTED) {
433+
if (ret != -ECONNABORTED)
434434
rxrpc_kernel_abort_call(call->net->socket, rxcall,
435435
RX_USER_ABORT, ret,
436436
afs_abort_send_data_error);
437-
} else {
437+
if (call->async) {
438+
afs_see_call(call, afs_call_trace_async_abort);
439+
return;
440+
}
441+
442+
if (ret == -ECONNABORTED) {
438443
len = 0;
439444
iov_iter_kvec(&msg.msg_iter, ITER_DEST, NULL, 0, 0);
440445
rxrpc_kernel_recv_data(call->net->socket, rxcall,
@@ -445,6 +450,8 @@ void afs_make_call(struct afs_call *call, gfp_t gfp)
445450
call->error = ret;
446451
trace_afs_call_done(call);
447452
error_kill_call:
453+
if (call->async)
454+
afs_see_call(call, afs_call_trace_async_kill);
448455
if (call->type->done)
449456
call->type->done(call);
450457

@@ -602,7 +609,6 @@ static void afs_deliver_to_call(struct afs_call *call)
602609
abort_code = 0;
603610
call_complete:
604611
afs_set_call_complete(call, ret, remote_abort);
605-
state = AFS_CALL_COMPLETE;
606612
goto done;
607613
}
608614

fs/afs/vl_alias.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ static char *afs_vl_get_cell_name(struct afs_cell *cell, struct key *key)
253253
static int yfs_check_canonical_cell_name(struct afs_cell *cell, struct key *key)
254254
{
255255
struct afs_cell *master;
256+
size_t name_len;
256257
char *cell_name;
257258

258259
cell_name = afs_vl_get_cell_name(cell, key);
@@ -264,8 +265,11 @@ static int yfs_check_canonical_cell_name(struct afs_cell *cell, struct key *key)
264265
return 0;
265266
}
266267

267-
master = afs_lookup_cell(cell->net, cell_name, strlen(cell_name),
268-
NULL, false);
268+
name_len = strlen(cell_name);
269+
if (!name_len || name_len > AFS_MAXCELLNAME)
270+
master = ERR_PTR(-EOPNOTSUPP);
271+
else
272+
master = afs_lookup_cell(cell->net, cell_name, name_len, NULL, false);
269273
kfree(cell_name);
270274
if (IS_ERR(master))
271275
return PTR_ERR(master);

fs/afs/vlclient.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
697697
return ret;
698698

699699
namesz = ntohl(call->tmp);
700-
if (namesz > AFS_MAXCELLNAME)
700+
if (namesz > YFS_VL_MAXCELLNAME)
701701
return afs_protocol_error(call, afs_eproto_cellname_len);
702702
paddedsz = (namesz + 3) & ~3;
703703
call->count = namesz;

fs/afs/xdr_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ union afs_xdr_dir_block {
8888

8989
struct {
9090
struct afs_xdr_dir_hdr hdr;
91-
u8 alloc_ctrs[AFS_DIR_MAX_BLOCKS];
91+
u8 alloc_ctrs[AFS_DIR_BLOCKS_WITH_CTR];
9292
__be16 hashtable[AFS_DIR_HASHTBL_SIZE];
9393
} meta;
9494

fs/afs/yfsclient.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,9 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call)
666666
static void yfs_done_fs_remove_file2(struct afs_call *call)
667667
{
668668
if (call->error == -ECONNABORTED &&
669-
call->abort_code == RX_INVALID_OPERATION) {
670-
set_bit(AFS_SERVER_FL_NO_RM2, &call->server->flags);
669+
(call->abort_code == RX_INVALID_OPERATION ||
670+
call->abort_code == RXGEN_OPCODE)) {
671+
set_bit(AFS_SERVER_FL_NO_RM2, &call->op->server->flags);
671672
call->op->flags |= AFS_OPERATION_DOWNGRADE;
672673
}
673674
}

0 commit comments

Comments
 (0)