ksmbd: allow write with FILE_APPEND_DATA
Subsystems (2)
Namjae Jeon
maintainerPATCH 1/1 ksmbd: allow write with FILE_APPEND_DATA
Windows client write with FILE_APPEND_DATA when using git. ksmbd should allow write it with this flags.
Z:\test>git commit -m "test"
fatal: cannot update the ref 'HEAD': unable to append to
'.git/logs/HEAD': Bad file descriptor
Signed-off-by Namjae Jeon <[email protected]>
--- fs/smb/server/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/vfs.c +1 -1
@@ -496,7 +496,7 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,int err =0 ;if (work->conn->connection_type) { -if (!(fp->daccess &FILE_WRITE_DATA_LE )) { +if (!(fp->daccess & (FILE_WRITE_DATA_LE |FILE_APPEND_DATA_LE ))) {pr_err ("no right to write(%pD)\n" , fp->filp); err = -EACCES ; goto out;
Signature · 1 line
2.25.1
Namjae Jeon
maintainerPATCH 1/1 ksmbd: add refcnt to ksmbd_conn struct
When sending an oplock break request, opinfo->conn is used, But freed ->conn can be used on multichannel.
This patch add a reference count to the ksmbd_conn struct so that it can be freed when it is no longer used.
Signed-off-by Namjae Jeon <[email protected]>
--- fs/smb/server/connection.c | 4 ++- fs/smb/server/connection.h | 1 + fs/smb/server/oplock.c | 55 +++++++++++--------------------------- fs/smb/server/vfs_cache.c | 3 +++ 4 files changed, 23 insertions(+), 40 deletions(-)
fs/smb/server/connection.c +3 -1
@@ -39,7 +39,8 @@ void ksmbd_conn_free(struct ksmbd_conn *conn)xa_destroy (&conn->sessions);kvfree (conn->request_buf);kfree (conn->preauth_info); -kfree (conn); +if (atomic_dec_and_test (&conn->refcnt)) +kfree (conn); }/**
@@ -68,6 +69,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(void) conn->um =NULL ;atomic_set (&conn->req_running,0 );atomic_set (&conn->r_count,0 ); +atomic_set (&conn->refcnt,1 ); conn->total_credits =1 ; conn->outstanding_credits =0 ;
fs/smb/server/connection.h +1 -0
@@ -106,6 +106,7 @@ struct ksmbd_conn {bool signing_negotiated;__le16 signing_algorithm;bool binding; +atomic_t refcnt; };struct ksmbd_conn_ops {
fs/smb/server/oplock.c +16 -39
148 lines not on this page · raw message
fs/smb/server/vfs_cache.c +3 -0
@@ -863,6 +863,8 @@ static bool session_fd_check(struct ksmbd_tree_connect *tcon,list_for_each_entry_rcu (op, &ci->m_op_list, op_entry) {if (op->conn != conn)continue ; +if (atomic_dec_and_test (&op->conn->refcnt)) +kfree (op->conn); op->conn =NULL ; }up_write (&ci->m_lock);
@@ -965,6 +967,7 @@ int ksmbd_reopen_durable_fd(struct ksmbd_work *work, struct ksmbd_file *fp)if (op->conn)continue ; op->conn = fp->conn; +atomic_inc (&op->conn->refcnt); }up_write (&ci->m_lock);
Signature · 1 line
2.25.1