Pull cifs fixes from Steve French: "A few small cifs fixes including two for stable, and fixing a regression introduced by the VFS change to file create" * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: cifs: set FILE_CREATED cifs: We do not drop reference to tlink in CIFSCheckMFSymlink() Add missing end of line termination to some cifs messages
Unified · Split
| @@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, · 476 unmodified lines | ||
| 477 | 477 | const int netfid, __u64 *pExtAttrBits, __u64 *pMask); |
| 478 | 478 | extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb); |
| 479 | 479 | extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr); |
| 480 | −extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr, | |
| 481 | − const unsigned char *path, | |
| 482 | − struct cifs_sb_info *cifs_sb, unsigned int xid); | |
| 480 | +extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, | |
| 481 | + struct cifs_sb_info *cifs_sb, | |
| 482 | + struct cifs_fattr *fattr, | |
| 483 | + const unsigned char *path); | |
| 483 | 484 | extern int mdfour(unsigned char *, unsigned char *, int); |
| 484 | 485 | extern int E_md4hash(const unsigned char *passwd, unsigned char *p16, |
| 485 | 486 | const struct nls_table *codepage); |
| @@ -4010,7 +4010,7 @@ QFileInfoRetry: · 4009 unmodified lines | ||
| 4010 | 4010 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
| 4011 | 4011 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
| 4012 | 4012 | if (rc) { |
| 4013 | − cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); | |
| 4013 | + cifs_dbg(FYI, "Send error in QFileInfo = %d", rc); | |
| 4014 | 4014 | } else { /* decode response */ |
| 4015 | 4015 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
| 4016 | 4016 | |
| @@ -4179,7 +4179,7 @@ UnixQFileInfoRetry: · 162 unmodified lines | ||
| 4179 | 4179 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
| 4180 | 4180 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
| 4181 | 4181 | if (rc) { |
| 4182 | − cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); | |
| 4182 | + cifs_dbg(FYI, "Send error in UnixQFileInfo = %d", rc); | |
| 4183 | 4183 | } else { /* decode response */ |
| 4184 | 4184 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
| 4185 | 4185 | |
| @@ -4263,7 +4263,7 @@ UnixQPathInfoRetry: · 77 unmodified lines | ||
| 4263 | 4263 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
| 4264 | 4264 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
| 4265 | 4265 | if (rc) { |
| 4266 | − cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); | |
| 4266 | + cifs_dbg(FYI, "Send error in UnixQPathInfo = %d", rc); | |
| 4267 | 4267 | } else { /* decode response */ |
| 4268 | 4268 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
| 4269 | 4269 | |
| @@ -193,7 +193,7 @@ check_name(struct dentry *direntry) · 192 unmodified lines | ||
| 193 | 193 | static int |
| 194 | 194 | cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, |
| 195 | 195 | struct tcon_link *tlink, unsigned oflags, umode_t mode, |
| 196 | − __u32 *oplock, struct cifs_fid *fid, int *created) | |
| 196 | + __u32 *oplock, struct cifs_fid *fid) | |
| 197 | 197 | { |
| 198 | 198 | int rc = -ENOENT; |
| 199 | 199 | int create_options = CREATE_NOT_DIR; |
| @@ -349,7 +349,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, · 149 unmodified lines | ||
| 349 | 349 | .device = 0, |
| 350 | 350 | }; |
| 351 | 351 | |
| 352 | − *created |= FILE_CREATED; | |
| 353 | 352 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
| 354 | 353 | args.uid = current_fsuid(); |
| 355 | 354 | if (inode->i_mode & S_ISGID) |
| @@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, · 124 unmodified lines | ||
| 480 | 479 | cifs_add_pending_open(&fid, tlink, &open); |
| 481 | 480 | |
| 482 | 481 | rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, |
| 483 | − &oplock, &fid, opened); | |
| 482 | + &oplock, &fid); | |
| 484 | 483 | |
| 485 | 484 | if (rc) { |
| 486 | 485 | cifs_del_pending_open(&open); |
| 487 | 486 | goto out; |
| 488 | 487 | } |
| 489 | 488 | |
| 489 | + if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | |
| 490 | + *opened |= FILE_CREATED; | |
| 491 | + | |
| 490 | 492 | rc = finish_open(file, direntry, generic_file_open, opened); |
| 491 | 493 | if (rc) { |
| 492 | 494 | if (server->ops->close) |
| @@ -529,7 +531,6 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, · 36 unmodified lines | ||
| 529 | 531 | struct TCP_Server_Info *server; |
| 530 | 532 | struct cifs_fid fid; |
| 531 | 533 | __u32 oplock; |
| 532 | − int created = FILE_CREATED; | |
| 533 | 534 | |
| 534 | 535 | cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n", |
| 535 | 536 | inode, direntry->d_name.name, direntry); |
| @@ -546,7 +547,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, · 10 unmodified lines | ||
| 546 | 547 | server->ops->new_lease_key(&fid); |
| 547 | 548 | |
| 548 | 549 | rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, |
| 549 | − &oplock, &fid, &created); | |
| 550 | + &oplock, &fid); | |
| 550 | 551 | if (!rc && server->ops->close) |
| 551 | 552 | server->ops->close(xid, tcon, &fid); |
| 552 | 553 | |
| @@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, · 382 unmodified lines | ||
| 383 | 383 | |
| 384 | 384 | /* check for Minshall+French symlinks */ |
| 385 | 385 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) { |
| 386 | − int tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid); | |
| 386 | + int tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr, | |
| 387 | + full_path); | |
| 387 | 388 | if (tmprc) |
| 388 | 389 | cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc); |
| 389 | 390 | } |
| @@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, · 409 unmodified lines | ||
| 799 | 800 | |
| 800 | 801 | /* check for Minshall+French symlinks */ |
| 801 | 802 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) { |
| 802 | − tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid); | |
| 803 | + tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr, | |
| 804 | + full_path); | |
| 803 | 805 | if (tmprc) |
| 804 | 806 | cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc); |
| 805 | 807 | } |
| @@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, · 353 unmodified lines | ||
| 354 | 354 | |
| 355 | 355 | |
| 356 | 356 | int |
| 357 | −CIFSCheckMFSymlink(struct cifs_fattr *fattr, | |
| 358 | − const unsigned char *path, | |
| 359 | − struct cifs_sb_info *cifs_sb, unsigned int xid) | |
| 357 | +CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, | |
| 358 | + struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, | |
| 359 | + const unsigned char *path) | |
| 360 | 360 | { |
| 361 | − int rc = 0; | |
| 361 | + int rc; | |
| 362 | 362 | u8 *buf = NULL; |
| 363 | 363 | unsigned int link_len = 0; |
| 364 | 364 | unsigned int bytes_read = 0; |
| 365 | − struct cifs_tcon *ptcon; | |
| 366 | 365 | |
| 367 | 366 | if (!CIFSCouldBeMFSymlink(fattr)) |
| 368 | 367 | /* it's not a symlink */ |
| 369 | 368 | return 0; |
| 370 | 369 | |
| 371 | 370 | buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); |
| 372 | − if (!buf) { | |
| 373 | − rc = -ENOMEM; | |
| 374 | − goto out; | |
| 375 | − } | |
| 371 | + if (!buf) | |
| 372 | + return -ENOMEM; | |
| 376 | 373 | |
| 377 | − ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb)); | |
| 378 | − if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink)) | |
| 379 | − rc = ptcon->ses->server->ops->query_mf_symlink(path, buf, | |
| 380 | − &bytes_read, cifs_sb, xid); | |
| 374 | + if (tcon->ses->server->ops->query_mf_symlink) | |
| 375 | + rc = tcon->ses->server->ops->query_mf_symlink(path, buf, | |
| 376 | + &bytes_read, cifs_sb, xid); | |
| 381 | 377 | else |
| 382 | − goto out; | |
| 378 | + rc = -ENOSYS; | |
| 383 | 379 | |
| 384 | − if (rc != 0) | |
| 380 | + if (rc) | |
| 385 | 381 | goto out; |
| 386 | 382 | |
| 387 | 383 | if (bytes_read == 0) /* not a symlink */ |