You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
CIFS: Add cifs_set_oplock_level
Simplify many places when we need to set oplock level on an inode. Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
committed by
Steve French
parent
ce2f6fb8bd
commit
e66673e39a
+20
-3
@@ -569,10 +569,9 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
|
||||
|
||||
cFYI(1, "file id match, oplock break");
|
||||
pCifsInode = CIFS_I(netfile->dentry->d_inode);
|
||||
pCifsInode->clientCanCacheAll = false;
|
||||
if (pSMB->OplockLevel == 0)
|
||||
pCifsInode->clientCanCacheRead = false;
|
||||
|
||||
cifs_set_oplock_level(netfile->dentry->d_inode,
|
||||
pSMB->OplockLevel);
|
||||
/*
|
||||
* cifs_oplock_break_put() can't be called
|
||||
* from here. Get reference after queueing
|
||||
@@ -722,3 +721,21 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
|
||||
cifs_sb_master_tcon(cifs_sb)->treeName);
|
||||
}
|
||||
}
|
||||
|
||||
void cifs_set_oplock_level(struct inode *inode, __u32 oplock)
|
||||
{
|
||||
struct cifsInodeInfo *cinode = CIFS_I(inode);
|
||||
|
||||
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
|
||||
cinode->clientCanCacheAll = true;
|
||||
cinode->clientCanCacheRead = true;
|
||||
cFYI(1, "Exclusive Oplock granted on inode %p", inode);
|
||||
} else if ((oplock & 0xF) == OPLOCK_READ) {
|
||||
cinode->clientCanCacheAll = false;
|
||||
cinode->clientCanCacheRead = true;
|
||||
cFYI(1, "Level II Oplock granted on inode %p", inode);
|
||||
} else {
|
||||
cinode->clientCanCacheAll = false;
|
||||
cinode->clientCanCacheRead = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user