Changes-for-displaying-proc-files-related-output#514
Changes-for-displaying-proc-files-related-output#514vedansh-bhardwaj wants to merge 1 commit intonamjaejeon:masterfrom
Conversation
mmakassikis
left a comment
There was a problem hiding this comment.
A few comments from reading the code. I haven't compiled it or checked it for correctness.
| ccflags-y += -Wno-implicit-function-declaration | ||
| ccflags-y += -Wno-incompatible-pointer-types | ||
| ccflags-y += -Wno-unused-variable | ||
|
|
There was a problem hiding this comment.
these are good warnings to enable, but unrelated to the feature you are implementing. Perhaps they should be in a separate commit ?
There was a problem hiding this comment.
Removed these changes by fixing warning issues.
| { | ||
| if (user->name[0] == '\0') | ||
| return 1; | ||
| return 0; |
There was a problem hiding this comment.
this can be shortened to:
return user->name[0] == '\0';
and the return type should be bool, no ?
| return session->user->name; | ||
| } | ||
|
|
||
| static int show_proc_session(struct seq_file *m, void *v) |
There was a problem hiding this comment.
Isn't this function racy ?
the commented get_session() / put_session() hint that some locking to protect struct ksmbd_session from being freed.
Perhaps you meant ksmbd_user_session_get() and ksmbd_user_session_put() ?
| seq_printf(m, "#%-40s %-15s %-10s %-10s\n", | ||
| "<client>", "<user>", "<sess_id>", "<state>"); | ||
|
|
||
| down_read(&sessions_table_lock); |
There was a problem hiding this comment.
I don't know if this is enough. Code in mgmt/user_session.c that locks sessions_table_lock also locks the conn->session_lock.
|
|
||
| down_read(&sessions_table_lock); | ||
| hash_for_each(sessions_table, i, session, hlist) { | ||
| // get_session(session); |
There was a problem hiding this comment.
Is that a leftover, or do you need to use ksmbd_user_session_get() and ksmbd_user_session_put() ?
| * on reauthetication. | ||
| */ | ||
| if (conn->binding == false && ksmbd_anonymous_user(user)) { | ||
| if (conn->binding == false && user_anonymous(user)) { |
There was a problem hiding this comment.
I hadn't noticed user_anonymous() is ksmbd_anonymous_user(). I guess it's more coherent with user_guest(), but shouldn't that be a separate commit ?
| #ifndef __KSMBD_STATS_H__ | ||
| #define __KSMBD_STATS_H__ | ||
|
|
||
| #define KSMBD_COUNTER_MAX_REQS 19 |
There was a problem hiding this comment.
Can you add an explanation as to where the magic value comes from ? (even better: is it possible to get rid of it ?)
There was a problem hiding this comment.
There are 19 SMB2 commands defined in smb2pdu.h file
| #else | ||
| struct ksmbd_counters { | ||
| int counters[0]; | ||
| }; |
There was a problem hiding this comment.
is it necessary to declare ksmbd_counters in the !PROCFS case ?
|
|
||
| handler = kthread_run(ksmbd_conn_handler_loop, | ||
| KSMBD_TRANS(t)->conn, | ||
| conn, |
There was a problem hiding this comment.
this looks like code from a different commit
| #define SMB2_LEASE_NONE_LE cpu_to_le32(0x00) | ||
| #define SMB2_LEASE_READ_CACHING_LE cpu_to_le32(0x01) | ||
| #define SMB2_LEASE_HANDLE_CACHING_LE cpu_to_le32(0x02) | ||
| #define SMB2_LEASE_WRITE_CACHING_LE cpu_to_le32(0x04) |
There was a problem hiding this comment.
use the values from fs/smb/common/smb2pdu.h
|
Hi @mmakassikis Thanks for your inputs currently i am doing changes according to your inputs i will update here once changes are done. Thanks |
0596001 to
aa9ec35
Compare
|
Hi @mmakassikis made the changes as per your input. Please review and let us know if any changes required. Thanks |
|
@vedansh-bhardwaj Can you run checkpatch.pl and fix the warnings ? there is checkpatch.pl script in linux kernel source. and please use --strict option when running it. |
|
Hi @namjaejeon I will check and update you. Thanks |
576fd2c to
c39ec95
Compare
|
Hi @namjaejeon we fixed the warnings and errors except this below mentioned warning. Please review. Thanks |
|
@vedansh-bhardwaj Okay, I will check it. Thanks! |
| ksmbd_release_id(&sess->tree_conn_ida, id); | ||
| } | ||
|
|
||
| int ksmbd_sessions_init(void) |
There was a problem hiding this comment.
we don't need this wrapper function. please open code and directly use create_proc_sessions().
| #ifdef CONFIG_PROC_FS | ||
| struct proc_dir_entry *proc_entry; | ||
| #endif | ||
| struct ksmbd_conn *conn; |
There was a problem hiding this comment.
Please don't add conn here.
session can have several connection. So it is called as channel. So you can access conn through channel.
| __le16 signing_algorithm; | ||
| bool binding; | ||
|
|
||
| char client_name[INET6_ADDRSTRLEN + 1]; |
There was a problem hiding this comment.
Should it consume 49bytes per connection ? can we use inet6_addr or inet_addr ?
| else if (session->state == SMB2_SESSION_EXPIRED) | ||
| return "expired"; | ||
| else | ||
| return ""; |
There was a problem hiding this comment.
How about use switch condition instead of if ?
| } | ||
|
|
||
| i = 0; | ||
| xa_for_each(&sess->ksmbd_chann_list, id, chan) { |
There was a problem hiding this comment.
we can remove {} if loop is single line.
|
|
||
| struct proc_dir_entry *ksmbd_proc_create(const char *name, | ||
| int (*show)(struct seq_file *m, void *v), | ||
| void *v) |
There was a problem hiding this comment.
I prefer two tab and align it
There was a problem hiding this comment.
When i tried to add two tab and align it.
I am getting this Check.
vedansh@ws2030077069:~/ksmbd_vedansh/ksmbd$ ~/smb3-kernel/scripts/checkpatch.pl --strict 0001-Required-changes-for-displaying-proc-related-output.patch
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#551:
new file mode 100644
CHECK: Alignment should match open parenthesis
#582: FILE: proc.c:27:
+struct proc_dir_entry *ksmbd_proc_create(const char *name,
-
int (*show)(struct seq_file *m, void *v), void *v)
total: 0 errors, 1 warnings, 1 checks, 919 lines checked
| seq_printf(m, "written bytes: %lld\n", | ||
| ksmbd_counter_sum(KSMBD_COUNTER_WRITE_BYTES)); | ||
|
|
||
| seq_puts(m, "\nSmb2\n"); |
| ret = ksmbd_workqueue_init(); | ||
| if (ret) | ||
| goto err_crypto_destroy; | ||
|
|
| return le16_to_cpu(rcv_hdr->Command); | ||
| } | ||
|
|
||
| void smb2_inc_reqs(unsigned int cmd) |
There was a problem hiding this comment.
ditto, we can remove wrapper function and open code.
|
|
||
| static const struct ksmbd_const_name ksmbd_lease_const_names[] = { | ||
| {le32_to_cpu(SMB2_LEASE_NONE_LE), | ||
| "LEASE_NONE"}, |
There was a problem hiding this comment.
Is there any reason why you put "LEASE_NONE" in next line ? the line is over 80 ?
|
Hi @namjaejeon |
c39ec95 to
02c82e4
Compare
|
@vedansh-bhardwaj Okay, Looks good to me, BTW, there are so many signed-off-by and authors. Signed-off-by: v.bhardwaj v.bhardwaj@samsung.com
I don't think all of these people were involved. Please make signed-off-by up to 2 people and author up to 1 person. |
|
Hi @namjaejeon we will update. |
02c82e4 to
9fd563f
Compare
|
Hi @namjaejeon |
9fd563f to
ec390cc
Compare
This patch updates the logic used to display information through the proc files in ksmbd. The goal is to make the output more readable, structured, and aligned with kernel formatting conventions. Key changes include: - Refactored code handling proc file reads for better maintainability. - Updated data structures to ensure proper display of stats and status. - Improved consistency of field names and value formatting. Signed-off-by: Bahubali B Gumaji <bahubali.bg@samsung.com> Signed-off-by: Sang-Soo Lee <constant.lee@samsung.com>
ec390cc to
2ab60a9
Compare
|
@vedansh-bhardwaj I have updated your patch like this (18abb79). |
|
Hi @namjaejeon |
|
Hi @namjaejeon Any update on these proc related changes. thanks |
|
@vedansh-bhardwaj The proc patches are in next branch. It will be applied to master when linux 6.20-rc1 merge window open. |
|
Hi @namjaejeon |
This Commit has Changes related to display Proc files output.
Please review and let us know if any changes required.
Thanks