Skip to content

Commit 5edc22c

Browse files
Marc Dionnedhowells
authored andcommitted
afs: Set correct lock type for the yfs CreateFile
A lock type of 0 is "LockRead", which makes the fileserver record an unintentional read lock on the new file. This will cause problems later on if the file is the subject of locking operations. The correct default value should be -1 ("LockNone"). Fix the operation marshalling code to set the value and provide an enum to symbolise the values whilst we're at it. Fixes: 30062bd ("afs: Implement YFS support in the fs client") Signed-off-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com>
1 parent c2b8bd4 commit 5edc22c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

fs/afs/protocol_yfs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,14 @@ struct yfs_xdr_YFSStoreVolumeStatus {
161161
struct yfs_xdr_u64 max_quota;
162162
struct yfs_xdr_u64 file_quota;
163163
} __packed;
164+
165+
enum yfs_lock_type {
166+
yfs_LockNone = -1,
167+
yfs_LockRead = 0,
168+
yfs_LockWrite = 1,
169+
yfs_LockExtend = 2,
170+
yfs_LockRelease = 3,
171+
yfs_LockMandatoryRead = 0x100,
172+
yfs_LockMandatoryWrite = 0x101,
173+
yfs_LockMandatoryExtend = 0x102,
174+
};

fs/afs/yfsclient.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc,
803803
bp = xdr_encode_YFSFid(bp, &vnode->fid);
804804
bp = xdr_encode_string(bp, name, namesz);
805805
bp = xdr_encode_YFSStoreStatus_mode(bp, mode);
806-
bp = xdr_encode_u32(bp, 0); /* ViceLockType */
806+
bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */
807807
yfs_check_req(call, bp);
808808

809809
afs_use_fs_server(call, fc->cbi);

0 commit comments

Comments
 (0)