aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2b4ce1dad66..fafdcdffba62 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -201,7 +201,7 @@ int cifs_open(struct inode *inode, struct file *file)
201 } else { 201 } else {
202 if (file->f_flags & O_EXCL) 202 if (file->f_flags & O_EXCL)
203 cERROR(1, ("could not find file instance for " 203 cERROR(1, ("could not find file instance for "
204 "new file %p ", file)); 204 "new file %p", file));
205 } 205 }
206 } 206 }
207 207
@@ -260,10 +260,15 @@ int cifs_open(struct inode *inode, struct file *file)
260 rc = -ENOMEM; 260 rc = -ENOMEM;
261 goto out; 261 goto out;
262 } 262 }
263 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, 263
264 CREATE_NOT_DIR, &netfid, &oplock, buf, 264 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
265 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
266 desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
265 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags 267 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
266 & CIFS_MOUNT_MAP_SPECIAL_CHR); 268 & CIFS_MOUNT_MAP_SPECIAL_CHR);
269 else
270 rc = -EIO; /* no NT SMB support fall into legacy open below */
271
267 if (rc == -EIO) { 272 if (rc == -EIO) {
268 /* Old server, try legacy style OpenX */ 273 /* Old server, try legacy style OpenX */
269 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 274 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
@@ -272,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file)
272 & CIFS_MOUNT_MAP_SPECIAL_CHR); 277 & CIFS_MOUNT_MAP_SPECIAL_CHR);
273 } 278 }
274 if (rc) { 279 if (rc) {
275 cFYI(1, ("cifs_open returned 0x%x ", rc)); 280 cFYI(1, ("cifs_open returned 0x%x", rc));
276 goto out; 281 goto out;
277 } 282 }
278 file->private_data = 283 file->private_data =
@@ -409,8 +414,8 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
409 CIFS_MOUNT_MAP_SPECIAL_CHR); 414 CIFS_MOUNT_MAP_SPECIAL_CHR);
410 if (rc) { 415 if (rc) {
411 up(&pCifsFile->fh_sem); 416 up(&pCifsFile->fh_sem);
412 cFYI(1, ("cifs_open returned 0x%x ", rc)); 417 cFYI(1, ("cifs_open returned 0x%x", rc));
413 cFYI(1, ("oplock: %d ", oplock)); 418 cFYI(1, ("oplock: %d", oplock));
414 } else { 419 } else {
415 pCifsFile->netfid = netfid; 420 pCifsFile->netfid = netfid;
416 pCifsFile->invalidHandle = FALSE; 421 pCifsFile->invalidHandle = FALSE;
@@ -531,7 +536,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
531 (struct cifsFileInfo *)file->private_data; 536 (struct cifsFileInfo *)file->private_data;
532 char *ptmp; 537 char *ptmp;
533 538
534 cFYI(1, ("Closedir inode = 0x%p with ", inode)); 539 cFYI(1, ("Closedir inode = 0x%p", inode));
535 540
536 xid = GetXid(); 541 xid = GetXid();
537 542
@@ -605,7 +610,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
605 } 610 }
606 if (pfLock->fl_flags & FL_ACCESS) 611 if (pfLock->fl_flags & FL_ACCESS)
607 cFYI(1, ("Process suspended by mandatory locking - " 612 cFYI(1, ("Process suspended by mandatory locking - "
608 "not implemented yet ")); 613 "not implemented yet"));
609 if (pfLock->fl_flags & FL_LEASE) 614 if (pfLock->fl_flags & FL_LEASE)
610 cFYI(1, ("Lease on file - not implemented yet")); 615 cFYI(1, ("Lease on file - not implemented yet"));
611 if (pfLock->fl_flags & 616 if (pfLock->fl_flags &
@@ -1377,7 +1382,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1377 1382
1378 xid = GetXid(); 1383 xid = GetXid();
1379 1384
1380 cFYI(1, ("Sync file - name: %s datasync: 0x%x ", 1385 cFYI(1, ("Sync file - name: %s datasync: 0x%x",
1381 dentry->d_name.name, datasync)); 1386 dentry->d_name.name, datasync));
1382 1387
1383 rc = filemap_fdatawrite(inode->i_mapping); 1388 rc = filemap_fdatawrite(inode->i_mapping);
@@ -1406,7 +1411,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1406/* fill in rpages then 1411/* fill in rpages then
1407 result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */ 1412 result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */
1408 1413
1409/* cFYI(1, ("rpages is %d for sync page of Index %ld ", rpages, index)); 1414/* cFYI(1, ("rpages is %d for sync page of Index %ld", rpages, index));
1410 1415
1411#if 0 1416#if 0
1412 if (rc < 0) 1417 if (rc < 0)
@@ -1838,7 +1843,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
1838 if (rc < 0) 1843 if (rc < 0)
1839 goto io_error; 1844 goto io_error;
1840 else 1845 else
1841 cFYI(1, ("Bytes read %d ",rc)); 1846 cFYI(1, ("Bytes read %d",rc));
1842 1847
1843 file->f_dentry->d_inode->i_atime = 1848 file->f_dentry->d_inode->i_atime =
1844 current_fs_time(file->f_dentry->d_inode->i_sb); 1849 current_fs_time(file->f_dentry->d_inode->i_sb);
@@ -1959,3 +1964,19 @@ struct address_space_operations cifs_addr_ops = {
1959 /* .sync_page = cifs_sync_page, */ 1964 /* .sync_page = cifs_sync_page, */
1960 /* .direct_IO = */ 1965 /* .direct_IO = */
1961}; 1966};
1967
1968/*
1969 * cifs_readpages requires the server to support a buffer large enough to
1970 * contain the header plus one complete page of data. Otherwise, we need
1971 * to leave cifs_readpages out of the address space operations.
1972 */
1973struct address_space_operations cifs_addr_ops_smallbuf = {
1974 .readpage = cifs_readpage,
1975 .writepage = cifs_writepage,
1976 .writepages = cifs_writepages,
1977 .prepare_write = cifs_prepare_write,
1978 .commit_write = cifs_commit_write,
1979 .set_page_dirty = __set_page_dirty_nobuffers,
1980 /* .sync_page = cifs_sync_page, */
1981 /* .direct_IO = */
1982};