aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
commitbbd9d6f7fbb0305c9a592bf05a32e87eb364a4ff (patch)
tree12b2bb4202b05f6ae6a43c6ce830a0472043dbe5 /fs/cifs
parent8e204874db000928e37199c2db82b7eb8966cc3c (diff)
parent5a9a43646cf709312d71eca71cef90ad802f28f9 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (107 commits) vfs: use ERR_CAST for err-ptr tossing in lookup_instantiate_filp isofs: Remove global fs lock jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory fix IN_DELETE_SELF on overwriting rename() on ramfs et.al. mm/truncate.c: fix build for CONFIG_BLOCK not enabled fs:update the NOTE of the file_operations structure Remove dead code in dget_parent() AFS: Fix silly characters in a comment switch d_add_ci() to d_splice_alias() in "found negative" case as well simplify gfs2_lookup() jfs_lookup(): don't bother with . or .. get rid of useless dget_parent() in btrfs rename() and link() get rid of useless dget_parent() in fs/btrfs/ioctl.c fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers drivers: fix up various ->llseek() implementations fs: handle SEEK_HOLE/SEEK_DATA properly in all fs's that define their own llseek Ext4: handle SEEK_HOLE/SEEK_DATA generically Btrfs: implement our own ->llseek fs: add SEEK_HOLE and SEEK_DATA flags reiserfs: make reiserfs default to barrier=flush ... Fix up trivial conflicts in fs/xfs/linux-2.6/xfs_super.c due to the new shrinker callout for the inode cache, that clashed with the xfs code to start the periodic workers later.
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsfs.c11
-rw-r--r--fs/cifs/cifsfs.h4
-rw-r--r--fs/cifs/connect.c5
-rw-r--r--fs/cifs/dir.c14
-rw-r--r--fs/cifs/file.c18
-rw-r--r--fs/cifs/readdir.c2
6 files changed, 35 insertions, 19 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index bc4b12ca537b..865517470967 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -224,7 +224,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
224 return 0; 224 return 0;
225} 225}
226 226
227static int cifs_permission(struct inode *inode, int mask, unsigned int flags) 227static int cifs_permission(struct inode *inode, int mask)
228{ 228{
229 struct cifs_sb_info *cifs_sb; 229 struct cifs_sb_info *cifs_sb;
230 230
@@ -239,7 +239,7 @@ static int cifs_permission(struct inode *inode, int mask, unsigned int flags)
239 on the client (above and beyond ACL on servers) for 239 on the client (above and beyond ACL on servers) for
240 servers which do not support setting and viewing mode bits, 240 servers which do not support setting and viewing mode bits,
241 so allowing client to check permissions is useful */ 241 so allowing client to check permissions is useful */
242 return generic_permission(inode, mask, flags, NULL); 242 return generic_permission(inode, mask);
243} 243}
244 244
245static struct kmem_cache *cifs_inode_cachep; 245static struct kmem_cache *cifs_inode_cachep;
@@ -704,8 +704,11 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
704 704
705static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) 705static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
706{ 706{
707 /* origin == SEEK_END => we must revalidate the cached file length */ 707 /*
708 if (origin == SEEK_END) { 708 * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
709 * the cached file length
710 */
711 if (origin != SEEK_SET || origin != SEEK_CUR) {
709 int rc; 712 int rc;
710 struct inode *inode = file->f_path.dentry->d_inode; 713 struct inode *inode = file->f_path.dentry->d_inode;
711 714
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 036ca83e5f46..fbd050c8d52a 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -91,8 +91,8 @@ extern ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
91extern ssize_t cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, 91extern ssize_t cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
92 unsigned long nr_segs, loff_t pos); 92 unsigned long nr_segs, loff_t pos);
93extern int cifs_lock(struct file *, int, struct file_lock *); 93extern int cifs_lock(struct file *, int, struct file_lock *);
94extern int cifs_fsync(struct file *, int); 94extern int cifs_fsync(struct file *, loff_t, loff_t, int);
95extern int cifs_strict_fsync(struct file *, int); 95extern int cifs_strict_fsync(struct file *, loff_t, loff_t, int);
96extern int cifs_flush(struct file *, fl_owner_t id); 96extern int cifs_flush(struct file *, fl_owner_t id);
97extern int cifs_file_mmap(struct file * , struct vm_area_struct *); 97extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
98extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *); 98extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ccc1afa0bf3b..e66297bad412 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -320,9 +320,10 @@ requeue_echo:
320} 320}
321 321
322static int 322static int
323cifs_demultiplex_thread(struct TCP_Server_Info *server) 323cifs_demultiplex_thread(void *p)
324{ 324{
325 int length; 325 int length;
326 struct TCP_Server_Info *server = p;
326 unsigned int pdu_length, total_read; 327 unsigned int pdu_length, total_read;
327 struct smb_hdr *smb_buffer = NULL; 328 struct smb_hdr *smb_buffer = NULL;
328 struct smb_hdr *bigbuf = NULL; 329 struct smb_hdr *bigbuf = NULL;
@@ -1791,7 +1792,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1791 * this will succeed. No need for try_module_get(). 1792 * this will succeed. No need for try_module_get().
1792 */ 1793 */
1793 __module_get(THIS_MODULE); 1794 __module_get(THIS_MODULE);
1794 tcp_ses->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, 1795 tcp_ses->tsk = kthread_run(cifs_demultiplex_thread,
1795 tcp_ses, "cifsd"); 1796 tcp_ses, "cifsd");
1796 if (IS_ERR(tcp_ses->tsk)) { 1797 if (IS_ERR(tcp_ses->tsk)) {
1797 rc = PTR_ERR(tcp_ses->tsk); 1798 rc = PTR_ERR(tcp_ses->tsk);
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index fa8c21d913bc..14d602f178c2 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -179,7 +179,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
179 if (oplockEnabled) 179 if (oplockEnabled)
180 oplock = REQ_OPLOCK; 180 oplock = REQ_OPLOCK;
181 181
182 if (nd && (nd->flags & LOOKUP_OPEN)) 182 if (nd)
183 oflags = nd->intent.open.file->f_flags; 183 oflags = nd->intent.open.file->f_flags;
184 else 184 else
185 oflags = O_RDONLY | O_CREAT; 185 oflags = O_RDONLY | O_CREAT;
@@ -214,7 +214,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
214 which should be rare for path not covered on files) */ 214 which should be rare for path not covered on files) */
215 } 215 }
216 216
217 if (nd && (nd->flags & LOOKUP_OPEN)) { 217 if (nd) {
218 /* if the file is going to stay open, then we 218 /* if the file is going to stay open, then we
219 need to set the desired access properly */ 219 need to set the desired access properly */
220 desiredAccess = 0; 220 desiredAccess = 0;
@@ -328,7 +328,7 @@ cifs_create_set_dentry:
328 else 328 else
329 cFYI(1, "Create worked, get_inode_info failed rc = %d", rc); 329 cFYI(1, "Create worked, get_inode_info failed rc = %d", rc);
330 330
331 if (newinode && nd && (nd->flags & LOOKUP_OPEN)) { 331 if (newinode && nd) {
332 struct cifsFileInfo *pfile_info; 332 struct cifsFileInfo *pfile_info;
333 struct file *filp; 333 struct file *filp;
334 334
@@ -568,7 +568,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
568 * reduction in network traffic in the other paths. 568 * reduction in network traffic in the other paths.
569 */ 569 */
570 if (pTcon->unix_ext) { 570 if (pTcon->unix_ext) {
571 if (nd && !(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && 571 if (nd && !(nd->flags & LOOKUP_DIRECTORY) &&
572 (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && 572 (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
573 (nd->intent.open.file->f_flags & O_CREAT)) { 573 (nd->intent.open.file->f_flags & O_CREAT)) {
574 rc = cifs_posix_open(full_path, &newInode, 574 rc = cifs_posix_open(full_path, &newInode,
@@ -663,10 +663,8 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
663 * case sensitive name which is specified by user if this is 663 * case sensitive name which is specified by user if this is
664 * for creation. 664 * for creation.
665 */ 665 */
666 if (!(nd->flags & (LOOKUP_CONTINUE | LOOKUP_PARENT))) { 666 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
667 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 667 return 0;
668 return 0;
669 }
670 668
671 if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled) 669 if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled)
672 return 0; 670 return 0;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index a9b4a24f2a16..378acdafa356 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1401,7 +1401,8 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
1401 return rc; 1401 return rc;
1402} 1402}
1403 1403
1404int cifs_strict_fsync(struct file *file, int datasync) 1404int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
1405 int datasync)
1405{ 1406{
1406 int xid; 1407 int xid;
1407 int rc = 0; 1408 int rc = 0;
@@ -1410,6 +1411,11 @@ int cifs_strict_fsync(struct file *file, int datasync)
1410 struct inode *inode = file->f_path.dentry->d_inode; 1411 struct inode *inode = file->f_path.dentry->d_inode;
1411 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1412 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1412 1413
1414 rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
1415 if (rc)
1416 return rc;
1417 mutex_lock(&inode->i_mutex);
1418
1413 xid = GetXid(); 1419 xid = GetXid();
1414 1420
1415 cFYI(1, "Sync file - name: %s datasync: 0x%x", 1421 cFYI(1, "Sync file - name: %s datasync: 0x%x",
@@ -1428,16 +1434,23 @@ int cifs_strict_fsync(struct file *file, int datasync)
1428 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); 1434 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1429 1435
1430 FreeXid(xid); 1436 FreeXid(xid);
1437 mutex_unlock(&inode->i_mutex);
1431 return rc; 1438 return rc;
1432} 1439}
1433 1440
1434int cifs_fsync(struct file *file, int datasync) 1441int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1435{ 1442{
1436 int xid; 1443 int xid;
1437 int rc = 0; 1444 int rc = 0;
1438 struct cifs_tcon *tcon; 1445 struct cifs_tcon *tcon;
1439 struct cifsFileInfo *smbfile = file->private_data; 1446 struct cifsFileInfo *smbfile = file->private_data;
1440 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 1447 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1448 struct inode *inode = file->f_mapping->host;
1449
1450 rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
1451 if (rc)
1452 return rc;
1453 mutex_lock(&inode->i_mutex);
1441 1454
1442 xid = GetXid(); 1455 xid = GetXid();
1443 1456
@@ -1449,6 +1462,7 @@ int cifs_fsync(struct file *file, int datasync)
1449 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); 1462 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1450 1463
1451 FreeXid(xid); 1464 FreeXid(xid);
1465 mutex_unlock(&inode->i_mutex);
1452 return rc; 1466 return rc;
1453} 1467}
1454 1468
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 6751e745bbc6..965a3af186a1 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -796,7 +796,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
796 file->f_pos++; 796 file->f_pos++;
797 case 1: 797 case 1:
798 if (filldir(direntry, "..", 2, file->f_pos, 798 if (filldir(direntry, "..", 2, file->f_pos,
799 file->f_path.dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { 799 parent_ino(file->f_path.dentry), DT_DIR) < 0) {
800 cERROR(1, "Filldir for parent dir failed"); 800 cERROR(1, "Filldir for parent dir failed");
801 rc = -ENOMEM; 801 rc = -ENOMEM;
802 break; 802 break;