diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-05-22 14:28:35 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-22 14:28:35 -0400 |
commit | 9bd7de51ee8537094656149eaf45338cadb7d7d4 (patch) | |
tree | a691987319dfcdb07de2bce619746f88d26882c4 /fs | |
parent | e4b636366c00738b9609cda307014d71b1225b7f (diff) | |
parent | 6a44587ee716ac911082cbdec766e5b3f051c071 (diff) |
Merge branch 'master' into for-2.6.31
Conflicts:
drivers/ide/ide-io.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifssmb.c | 2 | ||||
-rw-r--r-- | fs/cifs/dir.c | 14 | ||||
-rw-r--r-- | fs/cifs/file.c | 66 | ||||
-rw-r--r-- | fs/cifs/link.c | 52 | ||||
-rw-r--r-- | fs/nilfs2/ioctl.c | 2 |
5 files changed, 72 insertions, 64 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 5759ba53dc96..d06260251c30 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -2475,7 +2475,7 @@ querySymLinkRetry: | |||
2475 | /* BB FIXME investigate remapping reserved chars here */ | 2475 | /* BB FIXME investigate remapping reserved chars here */ |
2476 | *symlinkinfo = cifs_strndup_from_ucs(data_start, count, | 2476 | *symlinkinfo = cifs_strndup_from_ucs(data_start, count, |
2477 | is_unicode, nls_codepage); | 2477 | is_unicode, nls_codepage); |
2478 | if (!symlinkinfo) | 2478 | if (!*symlinkinfo) |
2479 | rc = -ENOMEM; | 2479 | rc = -ENOMEM; |
2480 | } | 2480 | } |
2481 | } | 2481 | } |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 11431ed72a7f..f49d684edd96 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -225,6 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
225 | if (!(oflags & FMODE_READ)) | 225 | if (!(oflags & FMODE_READ)) |
226 | write_only = true; | 226 | write_only = true; |
227 | 227 | ||
228 | mode &= ~current_umask(); | ||
228 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, | 229 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, |
229 | pnetfid, presp_data, &oplock, full_path, | 230 | pnetfid, presp_data, &oplock, full_path, |
230 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 231 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
@@ -310,7 +311,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
310 | return -ENOMEM; | 311 | return -ENOMEM; |
311 | } | 312 | } |
312 | 313 | ||
313 | mode &= ~current_umask(); | ||
314 | if (oplockEnabled) | 314 | if (oplockEnabled) |
315 | oplock = REQ_OPLOCK; | 315 | oplock = REQ_OPLOCK; |
316 | 316 | ||
@@ -336,7 +336,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
336 | else /* success, no need to query */ | 336 | else /* success, no need to query */ |
337 | goto cifs_create_set_dentry; | 337 | goto cifs_create_set_dentry; |
338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && | 338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && |
339 | (rc != -EOPNOTSUPP)) /* path not found or net err */ | 339 | (rc != -EOPNOTSUPP) && (rc != -EINVAL)) |
340 | goto cifs_create_out; | 340 | goto cifs_create_out; |
341 | /* else fallthrough to retry, using older open call, this is | 341 | /* else fallthrough to retry, using older open call, this is |
342 | case where server does not support this SMB level, and | 342 | case where server does not support this SMB level, and |
@@ -609,7 +609,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
609 | int xid; | 609 | int xid; |
610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ | 610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ |
611 | int oplock = 0; | 611 | int oplock = 0; |
612 | int mode; | ||
613 | __u16 fileHandle = 0; | 612 | __u16 fileHandle = 0; |
614 | bool posix_open = false; | 613 | bool posix_open = false; |
615 | struct cifs_sb_info *cifs_sb; | 614 | struct cifs_sb_info *cifs_sb; |
@@ -660,13 +659,12 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
660 | 659 | ||
661 | if (pTcon->unix_ext) { | 660 | if (pTcon->unix_ext) { |
662 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && | 661 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && |
663 | (nd->flags & LOOKUP_OPEN)) { | 662 | (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) { |
664 | if (!((nd->intent.open.flags & O_CREAT) && | 663 | if (!((nd->intent.open.flags & O_CREAT) && |
665 | (nd->intent.open.flags & O_EXCL))) { | 664 | (nd->intent.open.flags & O_EXCL))) { |
666 | mode = nd->intent.open.create_mode & | ||
667 | ~current_umask(); | ||
668 | rc = cifs_posix_open(full_path, &newInode, | 665 | rc = cifs_posix_open(full_path, &newInode, |
669 | parent_dir_inode->i_sb, mode, | 666 | parent_dir_inode->i_sb, |
667 | nd->intent.open.create_mode, | ||
670 | nd->intent.open.flags, &oplock, | 668 | nd->intent.open.flags, &oplock, |
671 | &fileHandle, xid); | 669 | &fileHandle, xid); |
672 | /* | 670 | /* |
@@ -681,6 +679,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
681 | */ | 679 | */ |
682 | if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) | 680 | if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) |
683 | posix_open = true; | 681 | posix_open = true; |
682 | else | ||
683 | pTcon->broken_posix_open = true; | ||
684 | } | 684 | } |
685 | } | 685 | } |
686 | if (!posix_open) | 686 | if (!posix_open) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 38c06f826575..302ea15f02e6 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -130,10 +130,6 @@ static inline int cifs_posix_open_inode_helper(struct inode *inode, | |||
130 | struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) | 130 | struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) |
131 | { | 131 | { |
132 | 132 | ||
133 | file->private_data = kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | ||
134 | if (file->private_data == NULL) | ||
135 | return -ENOMEM; | ||
136 | pCifsFile = cifs_init_private(file->private_data, inode, file, netfid); | ||
137 | write_lock(&GlobalSMBSeslock); | 133 | write_lock(&GlobalSMBSeslock); |
138 | 134 | ||
139 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | 135 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); |
@@ -184,6 +180,38 @@ psx_client_can_cache: | |||
184 | return 0; | 180 | return 0; |
185 | } | 181 | } |
186 | 182 | ||
183 | static struct cifsFileInfo * | ||
184 | cifs_fill_filedata(struct file *file) | ||
185 | { | ||
186 | struct list_head *tmp; | ||
187 | struct cifsFileInfo *pCifsFile = NULL; | ||
188 | struct cifsInodeInfo *pCifsInode = NULL; | ||
189 | |||
190 | /* search inode for this file and fill in file->private_data */ | ||
191 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | ||
192 | read_lock(&GlobalSMBSeslock); | ||
193 | list_for_each(tmp, &pCifsInode->openFileList) { | ||
194 | pCifsFile = list_entry(tmp, struct cifsFileInfo, flist); | ||
195 | if ((pCifsFile->pfile == NULL) && | ||
196 | (pCifsFile->pid == current->tgid)) { | ||
197 | /* mode set in cifs_create */ | ||
198 | |||
199 | /* needed for writepage */ | ||
200 | pCifsFile->pfile = file; | ||
201 | file->private_data = pCifsFile; | ||
202 | break; | ||
203 | } | ||
204 | } | ||
205 | read_unlock(&GlobalSMBSeslock); | ||
206 | |||
207 | if (file->private_data != NULL) { | ||
208 | return pCifsFile; | ||
209 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) | ||
210 | cERROR(1, ("could not find file instance for " | ||
211 | "new file %p", file)); | ||
212 | return NULL; | ||
213 | } | ||
214 | |||
187 | /* all arguments to this function must be checked for validity in caller */ | 215 | /* all arguments to this function must be checked for validity in caller */ |
188 | static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | 216 | static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, |
189 | struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, | 217 | struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, |
@@ -258,7 +286,6 @@ int cifs_open(struct inode *inode, struct file *file) | |||
258 | struct cifsTconInfo *tcon; | 286 | struct cifsTconInfo *tcon; |
259 | struct cifsFileInfo *pCifsFile; | 287 | struct cifsFileInfo *pCifsFile; |
260 | struct cifsInodeInfo *pCifsInode; | 288 | struct cifsInodeInfo *pCifsInode; |
261 | struct list_head *tmp; | ||
262 | char *full_path = NULL; | 289 | char *full_path = NULL; |
263 | int desiredAccess; | 290 | int desiredAccess; |
264 | int disposition; | 291 | int disposition; |
@@ -270,32 +297,12 @@ int cifs_open(struct inode *inode, struct file *file) | |||
270 | cifs_sb = CIFS_SB(inode->i_sb); | 297 | cifs_sb = CIFS_SB(inode->i_sb); |
271 | tcon = cifs_sb->tcon; | 298 | tcon = cifs_sb->tcon; |
272 | 299 | ||
273 | /* search inode for this file and fill in file->private_data */ | ||
274 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | 300 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); |
275 | read_lock(&GlobalSMBSeslock); | 301 | pCifsFile = cifs_fill_filedata(file); |
276 | list_for_each(tmp, &pCifsInode->openFileList) { | 302 | if (pCifsFile) { |
277 | pCifsFile = list_entry(tmp, struct cifsFileInfo, | ||
278 | flist); | ||
279 | if ((pCifsFile->pfile == NULL) && | ||
280 | (pCifsFile->pid == current->tgid)) { | ||
281 | /* mode set in cifs_create */ | ||
282 | |||
283 | /* needed for writepage */ | ||
284 | pCifsFile->pfile = file; | ||
285 | |||
286 | file->private_data = pCifsFile; | ||
287 | break; | ||
288 | } | ||
289 | } | ||
290 | read_unlock(&GlobalSMBSeslock); | ||
291 | |||
292 | if (file->private_data != NULL) { | ||
293 | rc = 0; | ||
294 | FreeXid(xid); | 303 | FreeXid(xid); |
295 | return rc; | 304 | return 0; |
296 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) | 305 | } |
297 | cERROR(1, ("could not find file instance for " | ||
298 | "new file %p", file)); | ||
299 | 306 | ||
300 | full_path = build_path_from_dentry(file->f_path.dentry); | 307 | full_path = build_path_from_dentry(file->f_path.dentry); |
301 | if (full_path == NULL) { | 308 | if (full_path == NULL) { |
@@ -325,6 +332,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
325 | /* no need for special case handling of setting mode | 332 | /* no need for special case handling of setting mode |
326 | on read only files needed here */ | 333 | on read only files needed here */ |
327 | 334 | ||
335 | pCifsFile = cifs_fill_filedata(file); | ||
328 | cifs_posix_open_inode_helper(inode, file, pCifsInode, | 336 | cifs_posix_open_inode_helper(inode, file, pCifsInode, |
329 | pCifsFile, oplock, netfid); | 337 | pCifsFile, oplock, netfid); |
330 | goto out; | 338 | goto out; |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index ea9d11e3dcbb..cd83c53fcbb5 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -107,48 +107,48 @@ void * | |||
107 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) | 107 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) |
108 | { | 108 | { |
109 | struct inode *inode = direntry->d_inode; | 109 | struct inode *inode = direntry->d_inode; |
110 | int rc = -EACCES; | 110 | int rc = -ENOMEM; |
111 | int xid; | 111 | int xid; |
112 | char *full_path = NULL; | 112 | char *full_path = NULL; |
113 | char *target_path = ERR_PTR(-ENOMEM); | 113 | char *target_path = NULL; |
114 | struct cifs_sb_info *cifs_sb; | 114 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
115 | struct cifsTconInfo *pTcon; | 115 | struct cifsTconInfo *tcon = cifs_sb->tcon; |
116 | 116 | ||
117 | xid = GetXid(); | 117 | xid = GetXid(); |
118 | 118 | ||
119 | full_path = build_path_from_dentry(direntry); | 119 | /* |
120 | * For now, we just handle symlinks with unix extensions enabled. | ||
121 | * Eventually we should handle NTFS reparse points, and MacOS | ||
122 | * symlink support. For instance... | ||
123 | * | ||
124 | * rc = CIFSSMBQueryReparseLinkInfo(...) | ||
125 | * | ||
126 | * For now, just return -EACCES when the server doesn't support posix | ||
127 | * extensions. Note that we still allow querying symlinks when posix | ||
128 | * extensions are manually disabled. We could disable these as well | ||
129 | * but there doesn't seem to be any harm in allowing the client to | ||
130 | * read them. | ||
131 | */ | ||
132 | if (!(tcon->ses->capabilities & CAP_UNIX)) { | ||
133 | rc = -EACCES; | ||
134 | goto out; | ||
135 | } | ||
120 | 136 | ||
137 | full_path = build_path_from_dentry(direntry); | ||
121 | if (!full_path) | 138 | if (!full_path) |
122 | goto out; | 139 | goto out; |
123 | 140 | ||
124 | cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); | 141 | cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); |
125 | cifs_sb = CIFS_SB(inode->i_sb); | ||
126 | pTcon = cifs_sb->tcon; | ||
127 | |||
128 | /* We could change this to: | ||
129 | if (pTcon->unix_ext) | ||
130 | but there does not seem any point in refusing to | ||
131 | get symlink info if we can, even if unix extensions | ||
132 | turned off for this mount */ | ||
133 | |||
134 | if (pTcon->ses->capabilities & CAP_UNIX) | ||
135 | rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path, | ||
136 | &target_path, | ||
137 | cifs_sb->local_nls); | ||
138 | else { | ||
139 | /* BB add read reparse point symlink code here */ | ||
140 | /* rc = CIFSSMBQueryReparseLinkInfo */ | ||
141 | /* BB Add code to Query ReparsePoint info */ | ||
142 | /* BB Add MAC style xsymlink check here if enabled */ | ||
143 | } | ||
144 | 142 | ||
143 | rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path, | ||
144 | cifs_sb->local_nls); | ||
145 | kfree(full_path); | ||
146 | out: | ||
145 | if (rc != 0) { | 147 | if (rc != 0) { |
146 | kfree(target_path); | 148 | kfree(target_path); |
147 | target_path = ERR_PTR(rc); | 149 | target_path = ERR_PTR(rc); |
148 | } | 150 | } |
149 | 151 | ||
150 | kfree(full_path); | ||
151 | out: | ||
152 | FreeXid(xid); | 152 | FreeXid(xid); |
153 | nd_set_link(nd, target_path); | 153 | nd_set_link(nd, target_path); |
154 | return NULL; | 154 | return NULL; |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 50ff3f2cdf24..d6759b92006f 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -576,7 +576,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
576 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); | 576 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); |
577 | 577 | ||
578 | out_free: | 578 | out_free: |
579 | while (--n > 0) | 579 | while (--n >= 0) |
580 | vfree(kbufs[n]); | 580 | vfree(kbufs[n]); |
581 | kfree(kbufs[4]); | 581 | kfree(kbufs[4]); |
582 | return ret; | 582 | return ret; |