]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From: Goldwyn Rodrigues <rgoldwyn@novell.com |
2 | Subject: Merge changes left out during code pull | |
3 | References: 445000 | |
4 | ||
5 | Also contains the fix for a clean shutdown during umount. | |
6 | ||
7 | --- | |
8 | fs/novfs/file.c | 55 ++++++++++++++++++++--------------------- | |
9 | fs/novfs/inode.c | 71 ++++++++++++++++++++++++++++++++++++------------------ | |
10 | fs/novfs/nwcapi.c | 13 ++++++--- | |
11 | fs/novfs/vfs.h | 3 +- | |
12 | 4 files changed, 85 insertions(+), 57 deletions(-) | |
13 | ||
14 | Index: linux-2.6.27/fs/novfs/file.c | |
15 | =================================================================== | |
16 | --- linux-2.6.27.orig/fs/novfs/file.c 2008-12-02 11:57:24.000000000 +0530 | |
17 | +++ linux-2.6.27/fs/novfs/file.c 2008-12-02 11:58:18.000000000 +0530 | |
18 | @@ -405,7 +405,7 @@ int novfs_setx_file_info(char *Path, con | |
19 | ||
20 | cmd->flags = flags; | |
21 | cmd->pathLen = pathlen; | |
22 | - memcpy(cmd->data, Path, cmd->pathLen + 1); //+ '\0' | |
23 | + memcpy(cmd->data, Path, cmd->pathLen); | |
24 | ||
25 | cmd->nameLen = namelen; | |
26 | memcpy(cmd->data + cmd->pathLen + 1, Name, cmd->nameLen + 1); | |
27 | @@ -601,7 +601,7 @@ static int begin_directory_enumerate(uns | |
28 | return (retCode); | |
29 | } | |
30 | ||
31 | -static int end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId) | |
32 | +int novfs_end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId) | |
33 | { | |
34 | struct novfs_end_enumerate_directory_request cmd; | |
35 | struct novfs_end_enumerate_directory_reply *reply = NULL; | |
36 | @@ -793,11 +793,9 @@ int novfs_get_dir_listex(unsigned char * | |
37 | directory_enumerate_ex(EnumHandle, SessionId, Count, Info, | |
38 | INTERRUPTIBLE); | |
39 | if (retCode) { | |
40 | - end_directory_enumerate(*EnumHandle, SessionId); | |
41 | - if (-1 == retCode) { | |
42 | - retCode = 0; | |
43 | - *EnumHandle = Uint32toHandle(-1); | |
44 | - } | |
45 | + novfs_end_directory_enumerate(*EnumHandle, SessionId); | |
46 | + retCode = 0; | |
47 | + *EnumHandle = Uint32toHandle(-1); | |
48 | } | |
49 | } | |
50 | return (retCode); | |
51 | @@ -915,32 +913,33 @@ int novfs_create(unsigned char * Path, i | |
52 | ||
53 | cmdlen = offsetof(struct novfs_create_file_request, path) + pathlen; | |
54 | cmd = kmalloc(cmdlen, GFP_KERNEL); | |
55 | - if (cmd) { | |
56 | - cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE; | |
57 | - if (DirectoryFlag) { | |
58 | - cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY; | |
59 | - } | |
60 | - cmd->Command.SequenceNumber = 0; | |
61 | - cmd->Command.SessionId = SessionId; | |
62 | + if (!cmd) | |
63 | + return -ENOMEM; | |
64 | + cmd->Command.CommandType = VFS_COMMAND_CREATE_FILE; | |
65 | + if (DirectoryFlag) { | |
66 | + cmd->Command.CommandType = VFS_COMMAND_CREATE_DIRECOTRY; | |
67 | + } | |
68 | + cmd->Command.SequenceNumber = 0; | |
69 | + cmd->Command.SessionId = SessionId; | |
70 | ||
71 | - cmd->pathlength = pathlen; | |
72 | - memcpy(cmd->path, Path, pathlen); | |
73 | + cmd->pathlength = pathlen; | |
74 | + memcpy(cmd->path, Path, pathlen); | |
75 | ||
76 | - retCode = | |
77 | - Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, | |
78 | - &replylen, INTERRUPTIBLE); | |
79 | + retCode = | |
80 | + Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, | |
81 | + &replylen, INTERRUPTIBLE); | |
82 | + | |
83 | + if (reply) { | |
84 | + retCode = 0; | |
85 | + if (reply->Reply.ErrorCode) { | |
86 | + retCode = -EIO; | |
87 | + if (reply->Reply.ErrorCode == NWE_ACCESS_DENIED) | |
88 | + retCode = -EACCES; | |
89 | ||
90 | - if (reply) { | |
91 | - retCode = 0; | |
92 | - if (reply->Reply.ErrorCode) { | |
93 | - retCode = -EIO; | |
94 | - } | |
95 | - kfree(reply); | |
96 | } | |
97 | - kfree(cmd); | |
98 | - } else { | |
99 | - retCode = -ENOMEM; | |
100 | + kfree(reply); | |
101 | } | |
102 | + kfree(cmd); | |
103 | return (retCode); | |
104 | } | |
105 | ||
106 | Index: linux-2.6.27/fs/novfs/inode.c | |
107 | =================================================================== | |
108 | --- linux-2.6.27.orig/fs/novfs/inode.c 2008-12-02 11:57:24.000000000 +0530 | |
109 | +++ linux-2.6.27/fs/novfs/inode.c 2008-12-02 11:58:35.000000000 +0530 | |
110 | @@ -137,11 +137,11 @@ int novfs_i_revalidate(struct dentry *de | |
111 | * Extended attributes operations | |
112 | */ | |
113 | ||
114 | -int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer, | |
115 | +ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer, | |
116 | size_t size); | |
117 | int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value, | |
118 | size_t value_size, int flags); | |
119 | -int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); | |
120 | +ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); | |
121 | ||
122 | void update_inode(struct inode *Inode, struct novfs_entry_info *Info); | |
123 | ||
124 | @@ -262,21 +262,17 @@ static struct inode_operations novfs_ino | |
125 | .rename = novfs_i_rename, | |
126 | .setattr = novfs_i_setattr, | |
127 | .getattr = novfs_i_getattr, | |
128 | -/* | |
129 | .getxattr = novfs_i_getxattr, | |
130 | .setxattr = novfs_i_setxattr, | |
131 | .listxattr = novfs_i_listxattr, | |
132 | -*/ | |
133 | }; | |
134 | ||
135 | static struct inode_operations novfs_file_inode_operations = { | |
136 | .setattr = novfs_i_setattr, | |
137 | .getattr = novfs_i_getattr, | |
138 | -/* | |
139 | .getxattr = novfs_i_getxattr, | |
140 | .setxattr = novfs_i_setxattr, | |
141 | .listxattr = novfs_i_listxattr, | |
142 | -*/ | |
143 | }; | |
144 | ||
145 | static struct super_operations novfs_ops = { | |
146 | @@ -935,14 +931,23 @@ int novfs_dir_open(struct inode *dir, st | |
147 | ||
148 | int novfs_dir_release(struct inode *dir, struct file *file) | |
149 | { | |
150 | - struct file_private *file_private; | |
151 | - file_private = (struct file_private *) file->private_data; | |
152 | + struct file_private *file_private = file->private_data; | |
153 | + struct inode *inode = file->f_dentry->d_inode; | |
154 | + struct novfs_schandle sessionId; | |
155 | ||
156 | DbgPrint("novfs_dir_release: Inode 0x%p %d Name %.*s\n", dir, | |
157 | dir->i_ino, file->f_dentry->d_name.len, | |
158 | file->f_dentry->d_name.name); | |
159 | ||
160 | if (file_private) { | |
161 | + if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) { | |
162 | + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope); | |
163 | + if (SC_PRESENT(sessionId) == 0) { | |
164 | + ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry); | |
165 | + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope); | |
166 | + } | |
167 | + novfs_end_directory_enumerate(file_private->enumHandle, sessionId); | |
168 | + } | |
169 | kfree(file_private); | |
170 | file->private_data = NULL; | |
171 | } | |
172 | @@ -966,6 +971,16 @@ loff_t novfs_dir_lseek(struct file * fil | |
173 | ||
174 | file_private = (struct file_private *) file->private_data; | |
175 | file_private->listedall = 0; | |
176 | + if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) { | |
177 | + struct novfs_schandle sessionId; | |
178 | + struct inode *inode = file->f_dentry->d_inode; | |
179 | + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope); | |
180 | + if (SC_PRESENT(sessionId) == 0) { | |
181 | + ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry); | |
182 | + sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope); | |
183 | + } | |
184 | + novfs_end_directory_enumerate(file_private->enumHandle, sessionId); | |
185 | + } | |
186 | file_private->enumHandle = NULL; | |
187 | ||
188 | return 0; | |
189 | @@ -2864,9 +2879,15 @@ int novfs_i_unlink(struct inode *dir, st | |
190 | } else { | |
191 | retCode = | |
192 | novfs_delete(path, | |
193 | - S_ISDIR(inode-> | |
194 | - i_mode), | |
195 | - session); | |
196 | + S_ISDIR(inode->i_mode), session); | |
197 | + if (retCode) { | |
198 | + struct iattr ia; | |
199 | + memset(&ia, 0, sizeof(ia)); | |
200 | + ia.ia_valid = ATTR_MODE; | |
201 | + ia.ia_mode = S_IRWXU; | |
202 | + novfs_set_attr(path, &ia, session); | |
203 | + retCode = novfs_delete(path, S_ISDIR(inode->i_mode), session); | |
204 | + } | |
205 | } | |
206 | if (!retCode || IS_DEADDIR(inode)) { | |
207 | novfs_remove_inode_entry(dir, | |
208 | @@ -3119,13 +3140,16 @@ int novfs_i_rename(struct inode *odir, s | |
209 | } | |
210 | ||
211 | retCode = | |
212 | - novfs_delete | |
213 | - (newpath, | |
214 | - S_ISDIR | |
215 | - (nd-> | |
216 | - d_inode-> | |
217 | - i_mode), | |
218 | - session); | |
219 | + novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session); | |
220 | + if (retCode) { | |
221 | + struct iattr ia; | |
222 | + memset(&ia, 0, sizeof(ia)); | |
223 | + ia.ia_valid = ATTR_MODE; | |
224 | + ia.ia_mode = S_IRWXU; | |
225 | + novfs_set_attr(newpath, &ia, session); | |
226 | + retCode = novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session); | |
227 | + } | |
228 | + | |
229 | } | |
230 | ||
231 | session = novfs_scope_get_sessionId(((struct inode_data *) ndir->i_private)->Scope); | |
232 | @@ -3378,7 +3402,7 @@ int novfs_i_getattr(struct vfsmount *mnt | |
233 | return (retCode); | |
234 | } | |
235 | ||
236 | -int novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer, | |
237 | +ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer, | |
238 | size_t buffer_size) | |
239 | { | |
240 | struct inode *inode = dentry->d_inode; | |
241 | @@ -3528,7 +3552,7 @@ int novfs_i_setxattr(struct dentry *dent | |
242 | return (retError); | |
243 | } | |
244 | ||
245 | -int novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | |
246 | +ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | |
247 | { | |
248 | struct inode *inode = dentry->d_inode; | |
249 | struct novfs_schandle sessionId; | |
250 | @@ -3720,6 +3744,9 @@ int novfs_statfs(struct dentry *de, stru | |
251 | DbgPrint("fd=%llu\n", fd); | |
252 | DbgPrint("te=%llu\n", te); | |
253 | DbgPrint("fe=%llu\n", fd); | |
254 | + /* fix for Nautilus */ | |
255 | + if (sb->s_blocksize == 0) | |
256 | + sb->s_blocksize = 4096; | |
257 | ||
258 | buf->f_type = sb->s_magic; | |
259 | buf->f_bsize = sb->s_blocksize; | |
260 | @@ -3762,7 +3789,6 @@ struct inode *novfs_get_inode(struct sup | |
261 | inode->i_mode = mode; | |
262 | inode->i_uid = Uid; | |
263 | inode->i_gid = 0; | |
264 | - inode->i_sb->s_blocksize = sb->s_blocksize; | |
265 | inode->i_blkbits = sb->s_blocksize_bits; | |
266 | inode->i_blocks = 0; | |
267 | inode->i_rdev = 0; | |
268 | @@ -3826,8 +3852,6 @@ struct inode *novfs_get_inode(struct sup | |
269 | case S_IFDIR: | |
270 | inode->i_op = &novfs_inode_operations; | |
271 | inode->i_fop = &novfs_dir_operations; | |
272 | - | |
273 | - inode->i_sb->s_blocksize = 0; | |
274 | inode->i_blkbits = 0; | |
275 | break; | |
276 | ||
277 | @@ -3957,6 +3981,7 @@ static int novfs_get_sb(struct file_syst | |
278 | ||
279 | static void novfs_kill_sb(struct super_block *super) | |
280 | { | |
281 | + shrink_dcache_sb(super); | |
282 | kill_litter_super(super); | |
283 | } | |
284 | ||
285 | Index: linux-2.6.27/fs/novfs/vfs.h | |
286 | =================================================================== | |
287 | --- linux-2.6.27.orig/fs/novfs/vfs.h 2008-12-02 11:57:24.000000000 +0530 | |
288 | +++ linux-2.6.27/fs/novfs/vfs.h 2008-12-02 11:58:18.000000000 +0530 | |
289 | @@ -344,7 +344,8 @@ extern int novfs_close_stream(void * Con | |
290 | struct novfs_schandle SessionId); | |
291 | ||
292 | extern int novfs_add_to_root(char *); | |
293 | - | |
294 | +extern int novfs_end_directory_enumerate(void *EnumHandle, | |
295 | + struct novfs_schandle SessionId); | |
296 | ||
297 | /* | |
298 | * scope.c functions | |
299 | Index: linux-2.6.27/fs/novfs/nwcapi.c | |
300 | =================================================================== | |
301 | --- linux-2.6.27.orig/fs/novfs/nwcapi.c 2008-12-02 11:57:24.000000000 +0530 | |
302 | +++ linux-2.6.27/fs/novfs/nwcapi.c 2008-12-02 11:58:18.000000000 +0530 | |
303 | @@ -1845,14 +1845,14 @@ int novfs_set_map_drive(struct novfs_xpl | |
304 | ||
305 | struct novfs_xplat_call_request *cmd; | |
306 | struct novfs_xplat_call_reply *reply; | |
307 | - unsigned long status = 0, datalen, cmdlen, replylen, cpylen; | |
308 | + unsigned long status = 0, datalen, cmdlen, replylen; | |
309 | struct nwc_map_drive_ex symInfo; | |
310 | ||
311 | DbgPrint("Call to NwcSetMapDrive\n"); | |
312 | - cpylen = copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo)); | |
313 | cmdlen = sizeof(*cmd); | |
314 | - datalen = | |
315 | - sizeof(symInfo) + symInfo.dirPathOffsetLength + | |
316 | + if (copy_from_user(&symInfo, pdata->reqData, sizeof(symInfo))) | |
317 | + return -EFAULT; | |
318 | + datalen = sizeof(symInfo) + symInfo.dirPathOffsetLength + | |
319 | symInfo.linkOffsetLength; | |
320 | ||
321 | DbgPrint(" cmdlen = %d\n", cmdlen); | |
322 | @@ -1876,7 +1876,10 @@ int novfs_set_map_drive(struct novfs_xpl | |
323 | cmd->Command.SessionId = Session; | |
324 | cmd->NwcCommand = NWC_MAP_DRIVE; | |
325 | ||
326 | - cpylen = copy_from_user(cmd->data, pdata->reqData, datalen); | |
327 | + if (copy_from_user(cmd->data, pdata->reqData, datalen)) { | |
328 | + kfree(cmd); | |
329 | + return -EFAULT; | |
330 | + } | |
331 | status = | |
332 | Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, | |
333 | (void **)&reply, &replylen, |