VFS: hocking close call ... (Samba 2.2.2)
Rainer Link
link at foo.fh-furtwangen.de
Sat Dec 29 10:05:02 GMT 2001
Hi!
I have a VFS-related question. My current (somehwat ugly)
"just-for-debugging" code looks like this:
int vscan_close(struct files_struct *fsp, int fd)
{
int result;
DEBUG(10, ("vscan_close start\n"));
syslog(SYSLOG_PRIORITY, "closing %s, fd %d\n", fsp->fsp_name,
fsp->fd);
result = default_vfs_ops.close(fsp, fd);
syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n",
fd,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
DEBUG(10, ("vscan_close end\n"));
return result;
}
Unfortunately, fsp->fsp_name is always NULL. Here's the snippet from
/var/log/messages:
Dec 29 18:40:15 rlss2 smbd_vscan_sophos[3853]: VFS_INIT: vscan_ops -
$Revision: 1.6 $ loaded
Dec 29 18:40:15 rlss2 smbd_vscan_sophos[3853]: connect to service 'test'
by user 'nobody'
Dec 29 18:40:15 rlss2 smbd_vscan_sophos[3853]: loading configuration
file
Dec 29 18:40:22 rlss2 smbd_vscan_sophos[3853]: closing (null), fd 23
Dec 29 18:40:22 rlss2 smbd_vscan_sophos[3853]: close fd 23
Looking at source/smbd/close.c I get:
[..]
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
conn->user,fsp->fsp_name,
conn->num_files_open, err ? strerror(err) : ""));
if (fsp->fsp_name) {
string_free(&fsp->fsp_name);
}
file_free(fsp);
So, my first guess was, fsp->fsp_name was already free'ed before my
vscan_close is called. But the log tell me, that's (may) not really the
case. The log snippet is:
[2001/12/29 18:40:22, 3] smbd/reply.c:reply_close(2999)
close fd=23 fnum=5563 (numopen=1)
[2001/12/29 18:40:22, 10] locking/locking.c:del_share_entry(499)
del_share_mode: num_share_modes = 1
[2001/12/29 18:40:22, 10] locking/locking.c:del_share_entry(510)
del_share_mode: deleting entry 0
[2001/12/29 18:40:22, 10] smbd/close.c:close_normal_file(157)
close_normal_file: share_entry_count = 0 for file modules.conf
[2001/12/29 18:40:22, 10] locking/posix.c:posix_locking_close_file(1254)
posix_locking_close_file: file modules.conf has no outstanding locks.
[2001/12/29 18:40:22, 10] vscan-sophos.c:vscan_close(268)
vscan_close start
[2001/12/29 18:40:22, 10] vscan-sophos.c:vscan_close(280)
vscan_close end
[2001/12/29 18:40:22, 2] smbd/close.c:close_normal_file(208)
nobody closed file modules.conf (numopen=0)
[2001/12/29 18:40:22, 5] smbd/files.c:file_free(306)
freed files structure 5563 (0 used)
[2001/12/29 18:40:22, 5] lib/util.c:show_msg(280)
So, in short: is there any way to get the file name of the file which
will be closed/was closed?
TIA
cheers, Rainer
More information about the samba-technical
mailing list