Bug 6819 - fsp->fsp_name
fsp->fsp_name
Status: RESOLVED WORKSFORME
Product: Samba 3.4
Classification: Unclassified
Component: VFS Modules
3.4.2
x86 Linux
: P3 normal
: ---
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-16 06:00 UTC by Daniel De Baerdemaeker
Modified: 2012-09-17 21:18 UTC (History)
1 user (show)

See Also:


Attachments
extract from messages -> null pointer (6.33 KB, text/plain)
2009-10-26 05:26 UTC, Daniel De Baerdemaeker
no flags Details
the source file of the vfs module (8.77 KB, text/x-csrc)
2009-10-26 05:27 UTC, Daniel De Baerdemaeker
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel De Baerdemaeker 2009-10-16 06:00:00 UTC
in vfs-close, thee fsp->fsp_name field is empty, so, if i want to get the name of the file that was closed, i had to add extra data to the fsp
on the web i see a lot of examples where fsp->fsp_name is used for getting the filename
i only used samba 3.4 did not try it on other versions
Comment 1 Jeremy Allison 2009-10-23 19:53:22 UTC
I don't see how the fsp->fsp_name can be empty when vfs_close is called. fsp->fsp_name is not cleared until the file struct is talloc freed.
Can you show me a backtrace with this occurring ?

Jeremy.
Comment 2 Daniel De Baerdemaeker 2009-10-26 05:26:00 UTC
Created attachment 4886 [details]
extract from messages -> null pointer
Comment 3 Daniel De Baerdemaeker 2009-10-26 05:27:14 UTC
Created attachment 4887 [details]
the source file of the vfs module
Comment 4 Holger Hetterich 2010-02-14 13:19:11 UTC
I am going to see if I can reproduce this inside vfs_smb_traffic_analyzer.
Comment 5 Holger Hetterich 2010-02-15 10:31:30 UTC
fsp->fsp_name is a struct smb_filename.


/*
 * smb_filename
 */
struct smb_filename {
        char *base_name;
        char *stream_name;
        char *original_lcomp;
        SMB_STRUCT_STAT st;
};

If you intend to get the filename, you then use
fsp->fsp_fname->base_name

It works for my close VFS operation in smb_traffic_analyzer.
Comment 6 Holger Hetterich 2010-03-05 15:24:01 UTC
I am resolving this as WORKSFORME, feel free to reopen the bug if you think different.
Comment 7 Alexander Morozov 2012-07-18 14:06:28 UTC
I encountered this problem on samba 3.5.
My vfs module got 0 or 0x10000 in fsp_name field in files_struct in close_fn handler.
I found that the problem appears when i use my module with samba built with --with-cluster-support=yes and module is built with samba sources configured to disable cluster support.
smb_filename offset depends on cluster support enabling:

typedef struct files_struct {
.................
        struct lock_struct last_lock_failure
.................
        struct smb_filename *fsp_name;
.................
} files_struct;

struct lock_struct {
        struct lock_context context;
............
};

struct lock_context {
        uint32 smbpid;
        uint16 tid;
        struct server_id pid;
};

struct server_id {
        pid_t pid;
#ifdef CLUSTER_SUPPORT
        uint32 vnn;
#endif
};

It is not good for distributing compiled modules that samba VFS API can be different for one SMB_VFS_INTERFACE_VERSION.
Comment 8 Jeremy Allison 2012-09-17 21:18:54 UTC
Yes, this is a valid complaint. I'll look into removing this problem.
Jeremy.