summaryrefslogtreecommitdiff
path: root/source3/modules/onefs_streams.c
diff options
context:
space:
mode:
authorAravind Srinivasan <aravind.srinivasan@isilon.com>2009-02-18 17:36:25 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-18 20:49:31 -0800
commit8e8aa27e1b1366c8c4e3cf6d8a681fec80cca858 (patch)
tree944be11156941821050a504a442a7e46b87a1fd7 /source3/modules/onefs_streams.c
parentc19214424b0f8ca0dfa5970880e54807880c443c (diff)
downloadsamba-8e8aa27e1b1366c8c4e3cf6d8a681fec80cca858.tar.gz
samba-8e8aa27e1b1366c8c4e3cf6d8a681fec80cca858.tar.bz2
samba-8e8aa27e1b1366c8c4e3cf6d8a681fec80cca858.zip
s3: Fix streams enumeration bug in OneFS implementation
Previously, we didn’t call SMB_VFS_OPEN_DIR from the streams module, instead we called fdopendir(). As a result we failed to populate the dir_state list in the readdirplus module. So when we tried to view the stream data, we will always returned NULL. To solve this I separated onefs_opendir() and the initialization of the dir_state list. This is done by introducing a new utility function “onefs_rdp_add_dir_state()”, which initializes the dir_state structure and adds it to the dir_state list. This function is called from the streams module before calling readdir().
Diffstat (limited to 'source3/modules/onefs_streams.c')
-rw-r--r--source3/modules/onefs_streams.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c
index d0dd75f259..9616ca48d5 100644
--- a/source3/modules/onefs_streams.c
+++ b/source3/modules/onefs_streams.c
@@ -540,6 +540,19 @@ static NTSTATUS walk_onefs_streams(connection_struct *conn, files_struct *fsp,
goto out;
}
+ /* Initialize the dir state struct and add it to the list.
+ * This is a layer violation, and really should be handled by a
+ * VFS_FDOPENDIR() call which would properly setup the dir state.
+ * But since this is all within the onefs.so module, we cheat for
+ * now and call directly into the readdirplus code.
+ * NOTE: This state MUST be freed by a proper VFS_CLOSEDIR() call. */
+ ret = onefs_rdp_add_dir_state(conn, dirp);
+ if (ret) {
+ DEBUG(0, ("Error adding dir_state to the list\n"));
+ status = map_nt_error_from_unix(errno);
+ goto out;
+ }
+
fake_fs.conn = conn;
fake_fs.fh = &fake_fh;
fake_fs.fsp_name = SMB_STRDUP(fname);