Commit 2af141c4 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 596a338d 9c4cdd29
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
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
------------
Fix oops on write to dead tcp session. Remove error log write for case when file open
......
/*
* 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)
*
* Contains the routines for constructing the SMB PDUs themselves
......@@ -656,7 +656,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
pSMB->AndXCommand = 0xFF; /* none */
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].Offset = cpu_to_le64(offset);
pSMB->ByteCount = sizeof (LOCKING_ANDX_RANGE);
......
......@@ -3,7 +3,7 @@
*
* 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)
*
* 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,
struct inode *newinode = NULL;
struct cifsFileInfo * pCifsFile = NULL;
struct cifsInodeInfo * pCifsInode;
int disposition = FILE_OVERWRITE_IF;
xid = GetXid();
......@@ -151,6 +152,16 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
desiredAccess = GENERIC_WRITE;
else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR)
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 */
......@@ -158,7 +169,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
oplock = REQ_OPLOCK;
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,
&fileHandle, &oplock, buf, cifs_sb->local_nls);
if (rc) {
......@@ -205,7 +216,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
memset((char *)pCifsFile, 0,
sizeof (struct cifsFileInfo));
pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->pid;
pCifsFile->pid = current->tgid;
pCifsFile->pInode = newinode;
/* pCifsFile->pfile = file; */ /* put in at open time */
write_lock(&GlobalSMBSeslock);
......@@ -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_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 */
/* check whether path exists */
......
......@@ -3,7 +3,7 @@
*
* 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)
*
* This library is free software; you can redistribute it and/or modify
......@@ -144,6 +144,10 @@ cifs_open(struct inode *inode, struct file *file)
list_add(&pCifsFile->tlist,&pTcon->openFileList);
pCifsInode = CIFS_I(file->f_dentry->d_inode);
if(pCifsInode) {
list_add(&pCifsFile->flist,&pCifsInode->openFileList);
write_unlock(&GlobalSMBSeslock);
write_unlock(&file->f_owner.lock);
if (pTcon->ses->capabilities & CAP_UNIX)
rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode,
full_path, inode->i_sb);
......@@ -151,16 +155,16 @@ cifs_open(struct inode *inode, struct file *file)
rc = cifs_get_inode_info(&file->f_dentry->d_inode,
full_path, buf, inode->i_sb);
list_add(&pCifsFile->flist,&pCifsInode->openFileList);
if(oplock == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE;
cFYI(1,("Exclusive Oplock granted on inode %p",file->f_dentry->d_inode));
} else if(oplock == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE;
} else {
write_unlock(&GlobalSMBSeslock);
write_unlock(&file->f_owner.lock);
}
write_unlock(&GlobalSMBSeslock);
write_unlock(&file->f_owner.lock);
if(file->f_flags & O_CREAT) {
/* time to set mode which we can not set earlier due
to problems creating new read-only files */
......@@ -221,16 +225,21 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
if(file) {
file->private_data = NULL;
read_unlock(&GlobalSMBSeslock);
rc = cifs_open(file->f_dentry->d_inode,file);
read_lock(&GlobalSMBSeslock);
if(rc) {
cFYI(1,("reconnecting file %s failed with %d",
file->f_dentry->d_name.name,rc));
if(file->f_dentry == 0) {
cFYI(1,("Null dentry for file %p",file));
read_lock(&GlobalSMBSeslock);
} else {
cFYI(1,("reconnection of %s succeeded",
file->f_dentry->d_name.name));
}
}
rc = cifs_open(file->f_dentry->d_inode,file);
read_lock(&GlobalSMBSeslock);
if(rc) {
cFYI(1,("reconnecting file %s failed with %d",
file->f_dentry->d_name.name,rc));
} else {
cFYI(1,("reconnection of %s succeeded",
file->f_dentry->d_name.name));
}
}
}
}
}
read_unlock(&GlobalSMBSeslock);
......
/*
* 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)
*
* This library is free software; you can redistribute it and/or modify
......@@ -345,6 +345,8 @@ cifs_unlink(struct inode *inode, struct dentry *direntry)
if (!rc) {
direntry->d_inode->i_nlink--;
} else if (rc == -ENOENT) {
d_drop(direntry);
} else if (rc == -ETXTBSY) {
int oplock = FALSE;
__u16 netfid;
......@@ -585,12 +587,24 @@ cifs_revalidate(struct dentry *direntry)
}
}
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
cifs_get_inode_info_unix(&direntry->d_inode, full_path,
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path,
direntry->d_sb);
else
cifs_get_inode_info(&direntry->d_inode, full_path, NULL,
if(rc) {
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);
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 */
......
/*
* 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)
*
* 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 */ ,
buffer->Command = smb_command;
buffer->Flags = 0x00; /* case sensitive */
buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
tmp = cpu_to_le32(current->pid);
tmp = cpu_to_le32(current->tgid);
buffer->Pid = tmp & 0xFFFF;
tmp >>= 16;
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