Hi, If one tries to do a fcntl(fd, F_SETLEASE, F_RDLCK) on a file that is open for writing, the error returned is always -EAGAIN. This seems like the wrong error return for the case where 'fd' points to a file_struct that has FMODE_WRITE set. No matter how many times one calls the fcntl on that 'fd' it will fail. Therefore, i think the return value should be -EINVAL in this case. The patch below implements this behavior. Some more context for this issue can be found at: http://lkml.org/lkml/2005/5/2/20. Patch is based on a suggestion from Jeff Layton. thanks, -Jason Signed-off-by: Jason Baron <jbaron@xxxxxxxxxx> --- linux-2.6/fs/locks.c.bak 2006-06-13 10:36:58.000000000 -0400 +++ linux-2.6/fs/locks.c 2006-06-13 10:41:19.000000000 -0400 @@ -1338,8 +1338,11 @@ lease = *flp; error = -EAGAIN; - if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) + if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) { + if (filp->f_mode & FMODE_WRITE) + error = -EINVAL; goto out; + } if ((arg == F_WRLCK) && ((atomic_read(&dentry->d_count) > 1) || (atomic_read(&inode->i_count) > 1))) - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html