Bug 14237 - Repeated mtab loop in vfs_fileid causing slow performance
Summary: Repeated mtab loop in vfs_fileid causing slow performance
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2020-01-16 15:18 UTC by Ralph Böhme
Modified: 2020-03-19 09:30 UTC (History)
2 users (show)

See Also:

Patch for 4.11 backported from master (2.03 KB, patch)
2020-03-16 13:49 UTC, Ralph Böhme
jra: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2020-01-16 15:18:11 UTC
This is an interesting performance issue on a Samba ctdb cluster when Samba is configured to use vfs_fileid, /etc/mtab of the system is somewhat large and the workload is eg copying small files to the server.

In strace I noticed a loop over the mtab for every file created, each iteration taking up to 500 ms due to calling stat+statfs on every mtab entry.

Looks like the problem is that we're calling vfs_file_id_from_sbuf() in
open_file_ntcreate() where smb_fname->st is still all zero for newly created files.

Have WIP fix, need bugnumber.
Comment 1 Ralph Böhme 2020-03-16 13:49:41 UTC
Created attachment 15866 [details]
Patch for 4.11 backported from master
Comment 2 Ralph Böhme 2020-03-16 13:50:09 UTC
Note that the fix is already in 4.12.
Comment 3 Jeremy Allison 2020-03-16 22:23:04 UTC
Comment on attachment 15866 [details]
Patch for 4.11 backported from master

Comment 4 Jeremy Allison 2020-03-16 22:23:29 UTC
Re-assigning to Karolin for inclusion in 4.11.next.
Comment 5 Karolin Seeger 2020-03-18 10:19:43 UTC
(In reply to Jeremy Allison from comment #4)
Pushed to autobuild-v4-11-test.
Comment 6 Karolin Seeger 2020-03-19 09:30:22 UTC
(In reply to Karolin Seeger from comment #5)
Pushed to v4-11-test.
Closing out bug report.