diff options
| author | Pavel Shilovsky <piastry@etersoft.ru> | 2011-10-22 06:37:50 -0400 |
|---|---|---|
| committer | Steve French <smfrench@gmail.com> | 2011-10-22 13:29:35 -0400 |
| commit | 42274bb22afc3e877ae5abed787b0b09d7dede52 (patch) | |
| tree | b5ea479122408c396557975f52a13e8dd753cea1 | |
| parent | a2d6b6cacb4fd4494b4037c01abb1332cefbb37b (diff) | |
CIFS: Fix DFS handling in cifs_get_file_info
We should call cifs_all_info_to_fattr in rc == 0 case only.
Cc: <stable@kernel.org>
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
| -rw-r--r-- | fs/cifs/inode.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 663c4e313be4..2c50bd2f65d1 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -562,7 +562,16 @@ int cifs_get_file_info(struct file *filp) | |||
| 562 | 562 | ||
| 563 | xid = GetXid(); | 563 | xid = GetXid(); |
| 564 | rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); | 564 | rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); |
| 565 | if (rc == -EOPNOTSUPP || rc == -EINVAL) { | 565 | switch (rc) { |
| 566 | case 0: | ||
| 567 | cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false); | ||
| 568 | break; | ||
| 569 | case -EREMOTE: | ||
| 570 | cifs_create_dfs_fattr(&fattr, inode->i_sb); | ||
| 571 | rc = 0; | ||
| 572 | break; | ||
| 573 | case -EOPNOTSUPP: | ||
| 574 | case -EINVAL: | ||
| 566 | /* | 575 | /* |
| 567 | * FIXME: legacy server -- fall back to path-based call? | 576 | * FIXME: legacy server -- fall back to path-based call? |
| 568 | * for now, just skip revalidating and mark inode for | 577 | * for now, just skip revalidating and mark inode for |
| @@ -570,18 +579,14 @@ int cifs_get_file_info(struct file *filp) | |||
| 570 | */ | 579 | */ |
| 571 | rc = 0; | 580 | rc = 0; |
| 572 | CIFS_I(inode)->time = 0; | 581 | CIFS_I(inode)->time = 0; |
| 582 | default: | ||
| 573 | goto cgfi_exit; | 583 | goto cgfi_exit; |
| 574 | } else if (rc == -EREMOTE) { | 584 | } |
| 575 | cifs_create_dfs_fattr(&fattr, inode->i_sb); | ||
| 576 | rc = 0; | ||
| 577 | } else if (rc) | ||
| 578 | goto cgfi_exit; | ||
| 579 | 585 | ||
| 580 | /* | 586 | /* |
| 581 | * don't bother with SFU junk here -- just mark inode as needing | 587 | * don't bother with SFU junk here -- just mark inode as needing |
| 582 | * revalidation. | 588 | * revalidation. |
| 583 | */ | 589 | */ |
| 584 | cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false); | ||
| 585 | fattr.cf_uniqueid = CIFS_I(inode)->uniqueid; | 590 | fattr.cf_uniqueid = CIFS_I(inode)->uniqueid; |
| 586 | fattr.cf_flags |= CIFS_FATTR_NEED_REVAL; | 591 | fattr.cf_flags |= CIFS_FATTR_NEED_REVAL; |
| 587 | cifs_fattr_to_inode(inode, &fattr); | 592 | cifs_fattr_to_inode(inode, &fattr); |
