+++ /dev/null
-From: Goldwyn Rodrigues <rgoldwyn@novell.com
-Subject: Merge changes left out during code pull
-References: 445000
-
-Also contains the fix for a clean shutdown during umount.
-
----
- fs/novfs/file.c | 55 ++++++++++++++++++++---------------------
- fs/novfs/inode.c | 71 ++++++++++++++++++++++++++++++++++++------------------
- fs/novfs/nwcapi.c | 13 ++++++---
- fs/novfs/vfs.h | 3 +-
- 4 files changed, 85 insertions(+), 57 deletions(-)
-
-Index: linux-2.6.27/fs/novfs/file.c
-===================================================================
---- linux-2.6.27.orig/fs/novfs/file.c 2008-12-02 11:57:24.000000000 +0530
-+++ linux-2.6.27/fs/novfs/file.c 2008-12-02 11:58:18.000000000 +0530
-@@ -405,7 +405,7 @@ int novfs_setx_file_info(char *Path, con
-
- cmd->flags = flags;
- cmd->pathLen = pathlen;
-- memcpy(cmd->data, Path, cmd->pathLen + 1); //+ '\0'
-+ memcpy(cmd->data, Path, cmd->pathLen);
-
- cmd->nameLen = namelen;
- memcpy(cmd->data + cmd->pathLen + 1, Name, cmd->nameLen + 1);
-@@ -601,7 +601,7 @@ static int begin_directory_enumerate(uns
- return (retCode);
- }
-
--static int end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId)
-+int novfs_end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId)
- {
- struct novfs_end_enumerate_directory_request cmd;
- struct novfs_end_enumerate_directory_reply *reply = NULL;
-@@ -793,11 +793,9 @@ int novfs_get_dir_listex(unsigned char *
- directory_enumerate_ex(EnumHandle, SessionId, Count, Info,
- INTERRUPTIBLE);
- if (retCode) {
-- end_directory_enumerate(*EnumHandle, SessionId);
-- if (-1 == retCode) {
-- retCode = 0;
-- *EnumHandle = Uint32toHandle(-1);
-- }
-+ novfs_end_directory_enumerate(*EnumHandle, SessionId);
-+ retCode = 0;
-+ *EnumHandle = Uint32toHandle(-1);
- }
- }
- return (retCode);
-@@ -915,32 +913,33 @@ int novfs_create(unsigned char * Path, i
-
- cmdlen = offsetof(struct novfs_create_file_request, path) + pathlen;
- cmd = kmalloc(cmdlen, GFP_KERNEL);
-- if (cmd) {
-- cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE;
-- if (DirectoryFlag) {
-- cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY;
-- }
-- cmd->Command.SequenceNumber = 0;
-- cmd->Command.SessionId = SessionId;
-+ if (!cmd)
-+ return -ENOMEM;
-+ cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE;
-+ if (DirectoryFlag) {
-+ cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY;
-+ }
-+ cmd->Command.SequenceNumber = 0;
-+ cmd->Command.SessionId = SessionId;
-
-- cmd->pathlength = pathlen;
-- memcpy(cmd->path, Path, pathlen);
-+ cmd->pathlength = pathlen;
-+ memcpy(cmd->path, Path, pathlen);
-
-- retCode =
-- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
-- &replylen, INTERRUPTIBLE);
-+ retCode =
-+ Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
-+ &replylen, INTERRUPTIBLE);
-+
-+ if (reply) {
-+ retCode = 0;
-+ if (reply->Reply.ErrorCode) {
-+ retCode = -EIO;
-+ if (reply->Reply.ErrorCode == NWE_ACCESS_DENIED)
-+ retCode = -EACCES;
-
-- if (reply) {
-- retCode = 0;
-- if (reply->Reply.ErrorCode) {
-- retCode = -EIO;
-- }
-- kfree(reply);
- }
-- kfree(cmd);
-- } else {
-- retCode = -ENOMEM;
-+ kfree(reply);
- }
-+ kfree(cmd);
- return (retCode);
- }
-
-Index: linux-2.6.27/fs/novfs/inode.c
-===================================================================
---- linux-2.6.27.orig/fs/novfs/inode.c 2008-12-02 11:57:24.000000000 +0530
-+++ linux-2.6.27/fs/novfs/inode.c 2008-12-02 11:58:35.000000000 +0530
-@@ -137,11 +137,11 @@ int novfs_i_revalidate(struct dentry *de
- * Extended attributes operations
- */
-
--int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
-+ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
- size_t size);
- int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value,
- size_t value_size, int flags);
--int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
-+ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
-
- void update_inode(struct inode *Inode, struct novfs_entry_info *Info);
-
-@@ -262,21 +262,17 @@ static struct inode_operations novfs_ino
- .rename = novfs_i_rename,
- .setattr = novfs_i_setattr,
- .getattr = novfs_i_getattr,
--/*
- .getxattr = novfs_i_getxattr,
- .setxattr = novfs_i_setxattr,
- .listxattr = novfs_i_listxattr,
--*/
- };
-
- static struct inode_operations novfs_file_inode_operations = {
- .setattr = novfs_i_setattr,
- .getattr = novfs_i_getattr,
--/*
- .getxattr = novfs_i_getxattr,
- .setxattr = novfs_i_setxattr,
- .listxattr = novfs_i_listxattr,
--*/
- };
-
- static struct super_operations novfs_ops = {
-@@ -935,14 +931,23 @@ int novfs_dir_open(struct inode *dir, st
-
- int novfs_dir_release(struct inode *dir, struct file *file)
- {
-- struct file_private *file_private;
-- file_private = (struct file_private *) file->private_data;
-+ struct file_private *file_private = file->private_data;
-+ struct inode *inode = file->f_dentry->d_inode;
-+ struct novfs_schandle sessionId;
-
- DbgPrint("novfs_dir_release: Inode 0x%p %d Name %.*s\n", dir,
- dir->i_ino, file->f_dentry->d_name.len,
- file->f_dentry->d_name.name);
-
- if (file_private) {
-+ if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
-+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
-+ if (SC_PRESENT(sessionId) == 0) {
-+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
-+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
-+ }
-+ novfs_end_directory_enumerate(file_private->enumHandle, sessionId);
-+ }
- kfree(file_private);
- file->private_data = NULL;
- }
-@@ -966,6 +971,16 @@ loff_t novfs_dir_lseek(struct file * fil
-
- file_private = (struct file_private *) file->private_data;
- file_private->listedall = 0;
-+ if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
-+ struct novfs_schandle sessionId;
-+ struct inode *inode = file->f_dentry->d_inode;
-+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
-+ if (SC_PRESENT(sessionId) == 0) {
-+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
-+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
-+ }
-+ novfs_end_directory_enumerate(file_private->enumHandle, sessionId);
-+ }
- file_private->enumHandle = NULL;
-
- return 0;
-@@ -2864,9 +2879,15 @@ int novfs_i_unlink(struct inode *dir, st
- } else {
- retCode =
- novfs_delete(path,
-- S_ISDIR(inode->
-- i_mode),
-- session);
-+ S_ISDIR(inode->i_mode), session);
-+ if (retCode) {
-+ struct iattr ia;
-+ memset(&ia, 0, sizeof(ia));
-+ ia.ia_valid = ATTR_MODE;
-+ ia.ia_mode = S_IRWXU;
-+ novfs_set_attr(path, &ia, session);
-+ retCode = novfs_delete(path, S_ISDIR(inode->i_mode), session);
-+ }
- }
- if (!retCode || IS_DEADDIR(inode)) {
- novfs_remove_inode_entry(dir,
-@@ -3119,13 +3140,16 @@ int novfs_i_rename(struct inode *odir, s
- }
-
- retCode =
-- novfs_delete
-- (newpath,
-- S_ISDIR
-- (nd->
-- d_inode->
-- i_mode),
-- session);
-+ novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session);
-+ if (retCode) {
-+ struct iattr ia;
-+ memset(&ia, 0, sizeof(ia));
-+ ia.ia_valid = ATTR_MODE;
-+ ia.ia_mode = S_IRWXU;
-+ novfs_set_attr(newpath, &ia, session);
-+ retCode = novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session);
-+ }
-+
- }
-
- session = novfs_scope_get_sessionId(((struct inode_data *) ndir->i_private)->Scope);
-@@ -3378,7 +3402,7 @@ int novfs_i_getattr(struct vfsmount *mnt
- return (retCode);
- }
-
--int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
-+ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
- size_t buffer_size)
- {
- struct inode *inode = dentry->d_inode;
-@@ -3528,7 +3552,7 @@ int novfs_i_setxattr(struct dentry *dent
- return (retError);
- }
-
--int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
-+ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
- {
- struct inode *inode = dentry->d_inode;
- struct novfs_schandle sessionId;
-@@ -3720,6 +3744,9 @@ int novfs_statfs(struct dentry *de, stru
- DbgPrint("fd=%llu\n", fd);
- DbgPrint("te=%llu\n", te);
- DbgPrint("fe=%llu\n", fd);
-+ /* fix for Nautilus */
-+ if (sb->s_blocksize == 0)
-+ sb->s_blocksize = 4096;
-
- buf->f_type = sb->s_magic;
- buf->f_bsize = sb->s_blocksize;
-@@ -3762,7 +3789,6 @@ struct inode *novfs_get_inode(struct sup
- inode->i_mode = mode;
- inode->i_uid = Uid;
- inode->i_gid = 0;
-- inode->i_sb->s_blocksize = sb->s_blocksize;
- inode->i_blkbits = sb->s_blocksize_bits;
- inode->i_blocks = 0;
- inode->i_rdev = 0;
-@@ -3826,8 +3852,6 @@ struct inode *novfs_get_inode(struct sup
- case S_IFDIR:
- inode->i_op = &novfs_inode_operations;
- inode->i_fop = &novfs_dir_operations;
--
-- inode->i_sb->s_blocksize = 0;
- inode->i_blkbits = 0;
- break;
-
-@@ -3957,6 +3981,7 @@ static int novfs_get_sb(struct file_syst
-
- static void novfs_kill_sb(struct super_block *super)
- {
-+ shrink_dcache_sb(super);
- kill_litter_super(super);
- }
-
-Index: linux-2.6.27/fs/novfs/vfs.h
-===================================================================
---- linux-2.6.27.orig/fs/novfs/vfs.h 2008-12-02 11:57:24.000000000 +0530
-+++ linux-2.6.27/fs/novfs/vfs.h 2008-12-02 11:58:18.000000000 +0530
-@@ -344,7 +344,8 @@ extern int novfs_close_stream(void * Con
- struct novfs_schandle SessionId);
-
- extern int novfs_add_to_root(char *);
--
-+extern int novfs_end_directory_enumerate(void *EnumHandle,
-+ struct novfs_schandle SessionId);
-
- /*
- * scope.c functions
-Index: linux-2.6.27/fs/novfs/nwcapi.c
-===================================================================
---- linux-2.6.27.orig/fs/novfs/nwcapi.c 2008-12-02 11:57:24.000000000 +0530
-+++ linux-2.6.27/fs/novfs/nwcapi.c 2008-12-02 11:58:18.000000000 +0530
-@@ -1845,14 +1845,14 @@ int novfs_set_map_drive(struct novfs_xpl
-
- struct novfs_xplat_call_request *cmd;
- struct novfs_xplat_call_reply *reply;
-- unsigned long status = 0, datalen, cmdlen, replylen, cpylen;
-+ unsigned long status = 0, datalen, cmdlen, replylen;
- struct nwc_map_drive_ex symInfo;
-
- DbgPrint("Call to NwcSetMapDrive\n");
-- cpylen = copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo));
- cmdlen = sizeof(*cmd);
-- datalen =
-- sizeof(symInfo) + symInfo.dirPathOffsetLength +
-+ if (copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo)))
-+ return -EFAULT;
-+ datalen = sizeof(symInfo) + symInfo.dirPathOffsetLength +
- symInfo.linkOffsetLength;
-
- DbgPrint(" cmdlen = %d\n", cmdlen);
-@@ -1876,7 +1876,10 @@ int novfs_set_map_drive(struct novfs_xpl
- cmd->Command.SessionId = Session;
- cmd->NwcCommand = NWC_MAP_DRIVE;
-
-- cpylen = copy_from_user(cmd->data, pdata->reqData, datalen);
-+ if (copy_from_user(cmd->data, pdata->reqData, datalen)) {
-+ kfree(cmd);
-+ return -EFAULT;
-+ }
- status =
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
- (void **)&reply, &replylen,