History

Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6

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

Linus Torvalds committed 12 years ago

Commit 03bdeda2 parents 71ce176 f1e32685 files · +28 −28Browse files

Unified · Split

5 files
  1. fs/cifs/cifsproto.h +4 −3
  2. fs/cifs/cifssmb.c +3 −3
  3. fs/cifs/dir.c +6 −5
  4. fs/cifs/inode.c +4 −2
  5. fs/cifs/link.c +11 −15
fs/cifs/cifsproto.h+4−3
@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, · 476 unmodified lines
477 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);477 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
478extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);478extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
479extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);479extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);
480extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr,480extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
481 const unsigned char *path,481 struct cifs_sb_info *cifs_sb,
482 struct cifs_sb_info *cifs_sb, unsigned int xid);482 struct cifs_fattr *fattr,
483 const unsigned char *path);
483extern int mdfour(unsigned char *, unsigned char *, int);484extern int mdfour(unsigned char *, unsigned char *, int);
484extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,485extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
485 const struct nls_table *codepage);486 const struct nls_table *codepage);
fs/cifs/cifssmb.c+3−3
@@ -4010,7 +4010,7 @@ QFileInfoRetry: · 4009 unmodified lines
4010 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,4010 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4011 (struct smb_hdr *) pSMBr, &bytes_returned, 0);4011 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4012 if (rc) {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 } else { /* decode response */4014 } else { /* decode response */
4015 rc = validate_t2((struct smb_t2_rsp *)pSMBr);4015 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
4016 4016
@@ -4179,7 +4179,7 @@ UnixQFileInfoRetry: · 162 unmodified lines
4179 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,4179 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4180 (struct smb_hdr *) pSMBr, &bytes_returned, 0);4180 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4181 if (rc) {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 } else { /* decode response */4183 } else { /* decode response */
4184 rc = validate_t2((struct smb_t2_rsp *)pSMBr);4184 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
4185 4185
@@ -4263,7 +4263,7 @@ UnixQPathInfoRetry: · 77 unmodified lines
4263 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,4263 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4264 (struct smb_hdr *) pSMBr, &bytes_returned, 0);4264 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4265 if (rc) {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 } else { /* decode response */4267 } else { /* decode response */
4268 rc = validate_t2((struct smb_t2_rsp *)pSMBr);4268 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
4269 4269
fs/cifs/dir.c+6−5
@@ -193,7 +193,7 @@ check_name(struct dentry *direntry) · 192 unmodified lines
193static int193static int
194cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,194cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
195 struct tcon_link *tlink, unsigned oflags, umode_t mode,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 int rc = -ENOENT;198 int rc = -ENOENT;
199 int create_options = CREATE_NOT_DIR;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 .device = 0,349 .device = 0,
350 };350 };
351 351
352 *created |= FILE_CREATED;
353 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {352 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
354 args.uid = current_fsuid();353 args.uid = current_fsuid();
355 if (inode->i_mode & S_ISGID)354 if (inode->i_mode & S_ISGID)
@@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, · 124 unmodified lines
480 cifs_add_pending_open(&fid, tlink, &open);479 cifs_add_pending_open(&fid, tlink, &open);
481 480
482 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,481 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
483 &oplock, &fid, opened);482 &oplock, &fid);
484 483
485 if (rc) {484 if (rc) {
486 cifs_del_pending_open(&open);485 cifs_del_pending_open(&open);
487 goto out;486 goto out;
488 }487 }
489 488
489 if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
490 *opened |= FILE_CREATED;
491
490 rc = finish_open(file, direntry, generic_file_open, opened);492 rc = finish_open(file, direntry, generic_file_open, opened);
491 if (rc) {493 if (rc) {
492 if (server->ops->close)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 struct TCP_Server_Info *server;531 struct TCP_Server_Info *server;
530 struct cifs_fid fid;532 struct cifs_fid fid;
531 __u32 oplock;533 __u32 oplock;
532 int created = FILE_CREATED;
533 534
534 cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",535 cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",
535 inode, direntry->d_name.name, direntry);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 server->ops->new_lease_key(&fid);547 server->ops->new_lease_key(&fid);
547 548
548 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,549 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
549 &oplock, &fid, &created);550 &oplock, &fid);
550 if (!rc && server->ops->close)551 if (!rc && server->ops->close)
551 server->ops->close(xid, tcon, &fid);552 server->ops->close(xid, tcon, &fid);
552 553
fs/cifs/inode.c+4−2
@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, · 382 unmodified lines
383 383
384 /* check for Minshall+French symlinks */384 /* check for Minshall+French symlinks */
385 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {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 if (tmprc)388 if (tmprc)
388 cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);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 /* check for Minshall+French symlinks */801 /* check for Minshall+French symlinks */
801 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {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 if (tmprc)805 if (tmprc)
804 cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);806 cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
805 }807 }
fs/cifs/link.c+11−15
@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, · 353 unmodified lines
354 354
355 355
356int356int
357CIFSCheckMFSymlink(struct cifs_fattr *fattr,357CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
358 const unsigned char *path,358 struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
359 struct cifs_sb_info *cifs_sb, unsigned int xid)359 const unsigned char *path)
360{360{
361 int rc = 0;361 int rc;
362 u8 *buf = NULL;362 u8 *buf = NULL;
363 unsigned int link_len = 0;363 unsigned int link_len = 0;
364 unsigned int bytes_read = 0;364 unsigned int bytes_read = 0;
365 struct cifs_tcon *ptcon;
366 365
367 if (!CIFSCouldBeMFSymlink(fattr))366 if (!CIFSCouldBeMFSymlink(fattr))
368 /* it's not a symlink */367 /* it's not a symlink */
369 return 0;368 return 0;
370 369
371 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);370 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
372 if (!buf) {371 if (!buf)
373 rc = -ENOMEM;372 return -ENOMEM;
374 goto out;
375 }
376 373
377 ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb));374 if (tcon->ses->server->ops->query_mf_symlink)
378 if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink))375 rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
379 rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,376 &bytes_read, cifs_sb, xid);
380 &bytes_read, cifs_sb, xid);
381 else377 else
382 goto out;378 rc = -ENOSYS;
383 379
384 if (rc != 0)380 if (rc)
385 goto out;381 goto out;
386 382
387 if (bytes_read == 0) /* not a symlink */383 if (bytes_read == 0) /* not a symlink */