Commit e352d0c7 authored by Steve French's avatar Steve French

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/repos/c/cifs/linux-2.5cifs
parents b18a7cb9 459de5e4
Version 0.91
------------
Fix oops in reopen_files when invalid dentry. drop dentry on server rename
and on revalidate errors. Fix cases where pid is now tgid. Fix return code
on create hard link when server does not support them.
Version 0.90
------------
Fix scheduling while atomic error in getting inode info on newly created file.
Fix truncate of existing files opened with O_CREAT but not O_TRUNC set.
Version 0.89 Version 0.89
------------ ------------
Fix oops on write to dead tcp session. Remove error log write for case when file open Fix oops on write to dead tcp session. Remove error log write for case when file open
......
/* /*
* fs/cifs/cifssmb.c * fs/cifs/cifssmb.c
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* Contains the routines for constructing the SMB PDUs themselves * Contains the routines for constructing the SMB PDUs themselves
...@@ -656,7 +656,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, ...@@ -656,7 +656,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
pSMB->AndXCommand = 0xFF; /* none */ pSMB->AndXCommand = 0xFF; /* none */
pSMB->Fid = smb_file_id; /* netfid stays le */ pSMB->Fid = smb_file_id; /* netfid stays le */
pSMB->Locks[0].Pid = cpu_to_le16(current->pid); pSMB->Locks[0].Pid = cpu_to_le16(current->tgid);
pSMB->Locks[0].Length = cpu_to_le64(len); pSMB->Locks[0].Length = cpu_to_le64(len);
pSMB->Locks[0].Offset = cpu_to_le64(offset); pSMB->Locks[0].Offset = cpu_to_le64(offset);
pSMB->ByteCount = sizeof (LOCKING_ANDX_RANGE); pSMB->ByteCount = sizeof (LOCKING_ANDX_RANGE);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* vfs operations that deal with dentries * vfs operations that deal with dentries
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -134,6 +134,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -134,6 +134,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
struct inode *newinode = NULL; struct inode *newinode = NULL;
struct cifsFileInfo * pCifsFile = NULL; struct cifsFileInfo * pCifsFile = NULL;
struct cifsInodeInfo * pCifsInode; struct cifsInodeInfo * pCifsInode;
int disposition = FILE_OVERWRITE_IF;
xid = GetXid(); xid = GetXid();
...@@ -151,6 +152,16 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -151,6 +152,16 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
desiredAccess = GENERIC_WRITE; desiredAccess = GENERIC_WRITE;
else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR)
desiredAccess = GENERIC_ALL; desiredAccess = GENERIC_ALL;
if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
disposition = FILE_CREATE;
else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
disposition = FILE_OVERWRITE_IF;
else if((nd->intent.open.flags & O_CREAT) == O_CREAT)
disposition = FILE_OPEN_IF;
else {
cFYI(1,("Create flag not set in create function"));
}
} }
/* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */ /* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */
...@@ -158,7 +169,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -158,7 +169,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF, rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
desiredAccess, CREATE_NOT_DIR, desiredAccess, CREATE_NOT_DIR,
&fileHandle, &oplock, buf, cifs_sb->local_nls); &fileHandle, &oplock, buf, cifs_sb->local_nls);
if (rc) { if (rc) {
...@@ -205,7 +216,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -205,7 +216,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
memset((char *)pCifsFile, 0, memset((char *)pCifsFile, 0,
sizeof (struct cifsFileInfo)); sizeof (struct cifsFileInfo));
pCifsFile->netfid = fileHandle; pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->pid; pCifsFile->pid = current->tgid;
pCifsFile->pInode = newinode; pCifsFile->pInode = newinode;
/* pCifsFile->pfile = file; */ /* put in at open time */ /* pCifsFile->pfile = file; */ /* put in at open time */
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
...@@ -297,6 +308,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name ...@@ -297,6 +308,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
(" parent inode = 0x%p name is: %s and dentry = 0x%p", (" parent inode = 0x%p name is: %s and dentry = 0x%p",
parent_dir_inode, direntry->d_name.name, direntry)); parent_dir_inode, direntry->d_name.name, direntry));
if(nd) { /* BB removeme */
cFYI(1,("In lookup nd flags 0x%x open intent flags 0x%x",nd->flags,nd->intent.open.flags));
} /* BB removeme BB */
/* BB Add check of incoming data - e.g. frame not longer than maximum SMB - let server check the namelen BB */ /* BB Add check of incoming data - e.g. frame not longer than maximum SMB - let server check the namelen BB */
/* check whether path exists */ /* check whether path exists */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* vfs operations that deal with files * vfs operations that deal with files
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -144,6 +144,10 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -144,6 +144,10 @@ cifs_open(struct inode *inode, struct file *file)
list_add(&pCifsFile->tlist,&pTcon->openFileList); list_add(&pCifsFile->tlist,&pTcon->openFileList);
pCifsInode = CIFS_I(file->f_dentry->d_inode); pCifsInode = CIFS_I(file->f_dentry->d_inode);
if(pCifsInode) { if(pCifsInode) {
list_add(&pCifsFile->flist,&pCifsInode->openFileList);
write_unlock(&GlobalSMBSeslock);
write_unlock(&file->f_owner.lock);
if (pTcon->ses->capabilities & CAP_UNIX) if (pTcon->ses->capabilities & CAP_UNIX)
rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode, rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode,
full_path, inode->i_sb); full_path, inode->i_sb);
...@@ -151,16 +155,16 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -151,16 +155,16 @@ cifs_open(struct inode *inode, struct file *file)
rc = cifs_get_inode_info(&file->f_dentry->d_inode, rc = cifs_get_inode_info(&file->f_dentry->d_inode,
full_path, buf, inode->i_sb); full_path, buf, inode->i_sb);
list_add(&pCifsFile->flist,&pCifsInode->openFileList);
if(oplock == OPLOCK_EXCLUSIVE) { if(oplock == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE; pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = TRUE;
cFYI(1,("Exclusive Oplock granted on inode %p",file->f_dentry->d_inode)); cFYI(1,("Exclusive Oplock granted on inode %p",file->f_dentry->d_inode));
} else if(oplock == OPLOCK_READ) } else if(oplock == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = TRUE;
} } else {
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
write_unlock(&file->f_owner.lock); write_unlock(&file->f_owner.lock);
}
if(file->f_flags & O_CREAT) { if(file->f_flags & O_CREAT) {
/* time to set mode which we can not set earlier due /* time to set mode which we can not set earlier due
to problems creating new read-only files */ to problems creating new read-only files */
...@@ -221,6 +225,10 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo) ...@@ -221,6 +225,10 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
if(file) { if(file) {
file->private_data = NULL; file->private_data = NULL;
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
if(file->f_dentry == 0) {
cFYI(1,("Null dentry for file %p",file));
read_lock(&GlobalSMBSeslock);
} else {
rc = cifs_open(file->f_dentry->d_inode,file); rc = cifs_open(file->f_dentry->d_inode,file);
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
if(rc) { if(rc) {
...@@ -233,6 +241,7 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo) ...@@ -233,6 +241,7 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
} }
} }
} }
}
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
return rc; return rc;
} }
......
/* /*
* fs/cifs/inode.c * fs/cifs/inode.c
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -345,6 +345,8 @@ cifs_unlink(struct inode *inode, struct dentry *direntry) ...@@ -345,6 +345,8 @@ cifs_unlink(struct inode *inode, struct dentry *direntry)
if (!rc) { if (!rc) {
direntry->d_inode->i_nlink--; direntry->d_inode->i_nlink--;
} else if (rc == -ENOENT) {
d_drop(direntry);
} else if (rc == -ETXTBSY) { } else if (rc == -ETXTBSY) {
int oplock = FALSE; int oplock = FALSE;
__u16 netfid; __u16 netfid;
...@@ -585,12 +587,24 @@ cifs_revalidate(struct dentry *direntry) ...@@ -585,12 +587,24 @@ cifs_revalidate(struct dentry *direntry)
} }
} }
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
cifs_get_inode_info_unix(&direntry->d_inode, full_path, rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path,
direntry->d_sb); direntry->d_sb);
else if(rc) {
cifs_get_inode_info(&direntry->d_inode, full_path, NULL, cFYI(1,("error on getting revalidate info %d",rc));
/* if(rc != -ENOENT)
rc = 0; */ /* BB should we cache info on certain errors? */
}
} else {
rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL,
direntry->d_sb); direntry->d_sb);
if(rc) {
cFYI(1,("error on getting revalidate info %d",rc));
/* if(rc != -ENOENT)
rc = 0; */ /* BB should we cache info on certain errors? */
}
}
/* should we remap certain errors, access denied?, to zero */
/* BB if not oplocked, invalidate inode pages if mtime has changed */ /* BB if not oplocked, invalidate inode pages if mtime has changed */
......
/* /*
* fs/cifs/link.c * fs/cifs/link.c
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -51,9 +51,12 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -51,9 +51,12 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX) if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX)
rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName, rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls); cifs_sb_target->local_nls);
else else {
rc = CIFSCreateHardLink(xid, pTcon, fromName, toName, rc = CIFSCreateHardLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls); cifs_sb_target->local_nls);
if(rc == -EIO)
rc = -EOPNOTSUPP;
}
/* if (!rc) */ /* if (!rc) */
{ {
......
/* /*
* fs/cifs/misc.c * fs/cifs/misc.c
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (c) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -213,7 +213,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -213,7 +213,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
buffer->Command = smb_command; buffer->Command = smb_command;
buffer->Flags = 0x00; /* case sensitive */ buffer->Flags = 0x00; /* case sensitive */
buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
tmp = cpu_to_le32(current->pid); tmp = cpu_to_le32(current->tgid);
buffer->Pid = tmp & 0xFFFF; buffer->Pid = tmp & 0xFFFF;
tmp >>= 16; tmp >>= 16;
buffer->PidHigh = tmp & 0xFFFF; buffer->PidHigh = tmp & 0xFFFF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment