diff options
author | David S. Miller <davem@davemloft.net> | 2012-03-09 17:34:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-09 17:34:20 -0500 |
commit | b2d3298e0916fa059712691c85a0e97becc4ab9f (patch) | |
tree | c7d5ea46a9dbf9cebdb122df4aaf0beda6e7621e /fs | |
parent | 1a0bdadb4e36abac63b0a9787f372aac30c11a9e (diff) | |
parent | a7f4255f906f60f72e00aad2fb000939449ff32e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/dir.c | 20 | ||||
-rw-r--r-- | fs/cifs/inode.c | 28 |
2 files changed, 37 insertions, 11 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 63a196b97d50..bc7e24420ac0 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -584,10 +584,26 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
584 | * If either that or op not supported returned, follow | 584 | * If either that or op not supported returned, follow |
585 | * the normal lookup. | 585 | * the normal lookup. |
586 | */ | 586 | */ |
587 | if ((rc == 0) || (rc == -ENOENT)) | 587 | switch (rc) { |
588 | case 0: | ||
589 | /* | ||
590 | * The server may allow us to open things like | ||
591 | * FIFOs, but the client isn't set up to deal | ||
592 | * with that. If it's not a regular file, just | ||
593 | * close it and proceed as if it were a normal | ||
594 | * lookup. | ||
595 | */ | ||
596 | if (newInode && !S_ISREG(newInode->i_mode)) { | ||
597 | CIFSSMBClose(xid, pTcon, fileHandle); | ||
598 | break; | ||
599 | } | ||
600 | case -ENOENT: | ||
588 | posix_open = true; | 601 | posix_open = true; |
589 | else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP)) | 602 | case -EOPNOTSUPP: |
603 | break; | ||
604 | default: | ||
590 | pTcon->broken_posix_open = true; | 605 | pTcon->broken_posix_open = true; |
606 | } | ||
591 | } | 607 | } |
592 | if (!posix_open) | 608 | if (!posix_open) |
593 | rc = cifs_get_inode_info_unix(&newInode, full_path, | 609 | rc = cifs_get_inode_info_unix(&newInode, full_path, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a5f54b7d9822..745da3d0653e 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -534,6 +534,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
534 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { | 534 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
535 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; | 535 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; |
536 | fattr->cf_dtype = DT_DIR; | 536 | fattr->cf_dtype = DT_DIR; |
537 | /* | ||
538 | * Server can return wrong NumberOfLinks value for directories | ||
539 | * when Unix extensions are disabled - fake it. | ||
540 | */ | ||
541 | fattr->cf_nlink = 2; | ||
537 | } else { | 542 | } else { |
538 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; | 543 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; |
539 | fattr->cf_dtype = DT_REG; | 544 | fattr->cf_dtype = DT_REG; |
@@ -541,9 +546,9 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
541 | /* clear write bits if ATTR_READONLY is set */ | 546 | /* clear write bits if ATTR_READONLY is set */ |
542 | if (fattr->cf_cifsattrs & ATTR_READONLY) | 547 | if (fattr->cf_cifsattrs & ATTR_READONLY) |
543 | fattr->cf_mode &= ~(S_IWUGO); | 548 | fattr->cf_mode &= ~(S_IWUGO); |
544 | } | ||
545 | 549 | ||
546 | fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); | 550 | fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); |
551 | } | ||
547 | 552 | ||
548 | fattr->cf_uid = cifs_sb->mnt_uid; | 553 | fattr->cf_uid = cifs_sb->mnt_uid; |
549 | fattr->cf_gid = cifs_sb->mnt_gid; | 554 | fattr->cf_gid = cifs_sb->mnt_gid; |
@@ -1322,7 +1327,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) | |||
1322 | } | 1327 | } |
1323 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need | 1328 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need |
1324 | to set uid/gid */ | 1329 | to set uid/gid */ |
1325 | inc_nlink(inode); | ||
1326 | 1330 | ||
1327 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); | 1331 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); |
1328 | cifs_fill_uniqueid(inode->i_sb, &fattr); | 1332 | cifs_fill_uniqueid(inode->i_sb, &fattr); |
@@ -1355,7 +1359,6 @@ mkdir_retry_old: | |||
1355 | d_drop(direntry); | 1359 | d_drop(direntry); |
1356 | } else { | 1360 | } else { |
1357 | mkdir_get_info: | 1361 | mkdir_get_info: |
1358 | inc_nlink(inode); | ||
1359 | if (pTcon->unix_ext) | 1362 | if (pTcon->unix_ext) |
1360 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 1363 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
1361 | inode->i_sb, xid); | 1364 | inode->i_sb, xid); |
@@ -1436,6 +1439,11 @@ mkdir_get_info: | |||
1436 | } | 1439 | } |
1437 | } | 1440 | } |
1438 | mkdir_out: | 1441 | mkdir_out: |
1442 | /* | ||
1443 | * Force revalidate to get parent dir info when needed since cached | ||
1444 | * attributes are invalid now. | ||
1445 | */ | ||
1446 | CIFS_I(inode)->time = 0; | ||
1439 | kfree(full_path); | 1447 | kfree(full_path); |
1440 | FreeXid(xid); | 1448 | FreeXid(xid); |
1441 | cifs_put_tlink(tlink); | 1449 | cifs_put_tlink(tlink); |
@@ -1475,7 +1483,6 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1475 | cifs_put_tlink(tlink); | 1483 | cifs_put_tlink(tlink); |
1476 | 1484 | ||
1477 | if (!rc) { | 1485 | if (!rc) { |
1478 | drop_nlink(inode); | ||
1479 | spin_lock(&direntry->d_inode->i_lock); | 1486 | spin_lock(&direntry->d_inode->i_lock); |
1480 | i_size_write(direntry->d_inode, 0); | 1487 | i_size_write(direntry->d_inode, 0); |
1481 | clear_nlink(direntry->d_inode); | 1488 | clear_nlink(direntry->d_inode); |
@@ -1483,12 +1490,15 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1483 | } | 1490 | } |
1484 | 1491 | ||
1485 | cifsInode = CIFS_I(direntry->d_inode); | 1492 | cifsInode = CIFS_I(direntry->d_inode); |
1486 | cifsInode->time = 0; /* force revalidate to go get info when | 1493 | /* force revalidate to go get info when needed */ |
1487 | needed */ | 1494 | cifsInode->time = 0; |
1488 | 1495 | ||
1489 | cifsInode = CIFS_I(inode); | 1496 | cifsInode = CIFS_I(inode); |
1490 | cifsInode->time = 0; /* force revalidate to get parent dir info | 1497 | /* |
1491 | since cached search results now invalid */ | 1498 | * Force revalidate to get parent dir info when needed since cached |
1499 | * attributes are invalid now. | ||
1500 | */ | ||
1501 | cifsInode->time = 0; | ||
1492 | 1502 | ||
1493 | direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = | 1503 | direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = |
1494 | current_fs_time(inode->i_sb); | 1504 | current_fs_time(inode->i_sb); |