Bug 11115 - S3: vfs_Chdir() is called after SMB_VFS_DISCONNECT in source3/smbd/service.c::close_cnum()
S3: vfs_Chdir() is called after SMB_VFS_DISCONNECT in source3/smbd/service.c:...
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
4.1.17
All All
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-25 02:32 UTC by Warren
Modified: 2015-06-15 14:55 UTC (History)
2 users (show)

See Also:


Attachments
git-am cherry-pick from master for 4.2.0, 4.1.next, 4.0.next. (1.31 KB, patch)
2015-02-25 21:59 UTC, Jeremy Allison
ira: review+
obnox: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Warren 2015-02-25 02:32:41 UTC
In source3/smbd/service.c::close_cnum(), vfs_ChDir() is called after SMB_VFS_DISCONNECT(). This can cause the problem for other vfs modules.

/* Call VFS disconnect hook */
SMB_VFS_DISCONNECT(conn);

/* make sure we leave the directory available for unmount */
vfs_ChDir(conn, "/");


It appears https://git.samba.org/?p=samba.git;a=commitdiff;h=81464daea71e5fa3067ec7d5f5c69c890c0f7949 has fixed this issue in master. But it is not pushed to the V4-1 or other release branch.

It is also questionable why we need to cache conn->cwd at all by calling vfs_GetWd() inside vfs_ChDir(), as we are going to free conn at the end of close_cnum() anyway.
Comment 1 Jeremy Allison 2015-02-25 21:59:49 UTC
Created attachment 10791 [details]
git-am cherry-pick from master for 4.2.0, 4.1.next, 4.0.next.

Applies cleanly to 4.1.next, 4.0.next. Just needs a +1 to be back-ported.
Comment 2 Jeremy Allison 2015-02-25 22:02:04 UTC
Comment on attachment 10791 [details]
git-am cherry-pick from master for 4.2.0, 4.1.next, 4.0.next.

Oh - also needs applying to 4.2.0 (or 4.2.1 if it's too late for the release).
Comment 3 Jeremy Allison 2015-02-25 22:04:29 UTC
Comment on attachment 10791 [details]
git-am cherry-pick from master for 4.2.0, 4.1.next, 4.0.next.

Michael/Ira, do we need this for 4.2.0 or will 4.2.1 be ok (apparently it affects the ceph VFS) ?
Comment 4 Ira Cooper 2015-02-25 22:13:09 UTC
I'd prefer 4.2.0, just because shipping broken * is bad when we can avoid it.

-Ira
Comment 5 Jeremy Allison 2015-02-25 22:19:46 UTC
Re-assigning to Karolin for inclusion in 4.2.0, 4.1.next, 4.0.next.
Comment 6 Karolin Seeger 2015-03-01 20:13:40 UTC
Pushed to autobuild-v4-[0|1|2]-test.
Comment 7 Karolin Seeger 2015-03-02 20:07:57 UTC
(In reply to Karolin Seeger from comment #6)
Pushed to all branches.
Closing out bug report.

Thanks!