mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
ksmbd: use list_for_each_entry instead of list_for_each
Use list_for_each_entry instead of list_for_each. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
f8524776f1
commit
6f3d5eeec7
3 changed files with 6 additions and 16 deletions
|
@ -73,10 +73,8 @@ static inline int check_session_id(struct ksmbd_conn *conn, u64 id)
|
||||||
struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn *conn)
|
struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn *conn)
|
||||||
{
|
{
|
||||||
struct channel *chann;
|
struct channel *chann;
|
||||||
struct list_head *t;
|
|
||||||
|
|
||||||
list_for_each(t, &sess->ksmbd_chann_list) {
|
list_for_each_entry(chann, &sess->ksmbd_chann_list, chann_list) {
|
||||||
chann = list_entry(t, struct channel, chann_list);
|
|
||||||
if (chann && chann->conn == conn)
|
if (chann && chann->conn == conn)
|
||||||
return chann;
|
return chann;
|
||||||
}
|
}
|
||||||
|
@ -6315,7 +6313,6 @@ int smb2_cancel(struct ksmbd_work *work)
|
||||||
struct smb2_hdr *hdr = work->request_buf;
|
struct smb2_hdr *hdr = work->request_buf;
|
||||||
struct smb2_hdr *chdr;
|
struct smb2_hdr *chdr;
|
||||||
struct ksmbd_work *cancel_work = NULL;
|
struct ksmbd_work *cancel_work = NULL;
|
||||||
struct list_head *tmp;
|
|
||||||
int canceled = 0;
|
int canceled = 0;
|
||||||
struct list_head *command_list;
|
struct list_head *command_list;
|
||||||
|
|
||||||
|
@ -6326,9 +6323,8 @@ int smb2_cancel(struct ksmbd_work *work)
|
||||||
command_list = &conn->async_requests;
|
command_list = &conn->async_requests;
|
||||||
|
|
||||||
spin_lock(&conn->request_lock);
|
spin_lock(&conn->request_lock);
|
||||||
list_for_each(tmp, command_list) {
|
list_for_each_entry(cancel_work, command_list,
|
||||||
cancel_work = list_entry(tmp, struct ksmbd_work,
|
async_request_entry) {
|
||||||
async_request_entry);
|
|
||||||
chdr = cancel_work->request_buf;
|
chdr = cancel_work->request_buf;
|
||||||
|
|
||||||
if (cancel_work->async_id !=
|
if (cancel_work->async_id !=
|
||||||
|
@ -6347,9 +6343,7 @@ int smb2_cancel(struct ksmbd_work *work)
|
||||||
command_list = &conn->requests;
|
command_list = &conn->requests;
|
||||||
|
|
||||||
spin_lock(&conn->request_lock);
|
spin_lock(&conn->request_lock);
|
||||||
list_for_each(tmp, command_list) {
|
list_for_each_entry(cancel_work, command_list, request_entry) {
|
||||||
cancel_work = list_entry(tmp, struct ksmbd_work,
|
|
||||||
request_entry);
|
|
||||||
chdr = cancel_work->request_buf;
|
chdr = cancel_work->request_buf;
|
||||||
|
|
||||||
if (chdr->MessageId != hdr->MessageId ||
|
if (chdr->MessageId != hdr->MessageId ||
|
||||||
|
|
|
@ -481,15 +481,13 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct ksmbd_file *prev_fp;
|
struct ksmbd_file *prev_fp;
|
||||||
struct list_head *cur;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lookup fp in master fp list, and check desired access and
|
* Lookup fp in master fp list, and check desired access and
|
||||||
* shared mode between previous open and current open.
|
* shared mode between previous open and current open.
|
||||||
*/
|
*/
|
||||||
read_lock(&curr_fp->f_ci->m_lock);
|
read_lock(&curr_fp->f_ci->m_lock);
|
||||||
list_for_each(cur, &curr_fp->f_ci->m_fp_list) {
|
list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) {
|
||||||
prev_fp = list_entry(cur, struct ksmbd_file, node);
|
|
||||||
if (file_inode(filp) != FP_INODE(prev_fp))
|
if (file_inode(filp) != FP_INODE(prev_fp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -472,15 +472,13 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct ksmbd_file *lfp;
|
struct ksmbd_file *lfp;
|
||||||
struct ksmbd_inode *ci;
|
struct ksmbd_inode *ci;
|
||||||
struct list_head *cur;
|
|
||||||
|
|
||||||
ci = ksmbd_inode_lookup_by_vfsinode(inode);
|
ci = ksmbd_inode_lookup_by_vfsinode(inode);
|
||||||
if (!ci)
|
if (!ci)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
read_lock(&ci->m_lock);
|
read_lock(&ci->m_lock);
|
||||||
list_for_each(cur, &ci->m_fp_list) {
|
list_for_each_entry(lfp, &ci->m_fp_list, node) {
|
||||||
lfp = list_entry(cur, struct ksmbd_file, node);
|
|
||||||
if (inode == FP_INODE(lfp)) {
|
if (inode == FP_INODE(lfp)) {
|
||||||
atomic_dec(&ci->m_count);
|
atomic_dec(&ci->m_count);
|
||||||
read_unlock(&ci->m_lock);
|
read_unlock(&ci->m_lock);
|
||||||
|
|
Loading…
Reference in a new issue