diff -aurN fuse-2.7.4/fuse.spec fuse-2.7.4glfs11/fuse.spec
--- fuse-2.7.4/fuse.spec	1969-12-31 16:00:00.000000000 -0800
+++ fuse-2.7.4glfs11/fuse.spec	2009-02-05 06:22:20.000000000 -0800
@@ -0,0 +1,204 @@
+# Supported rpmbuild --define and --with options include:
+#
+#   --without userland
+#	Build without the userland packages
+#	(i.e. only build the kernel-module packages).
+#
+#   --with modules
+#	Force the building of a kernel-module package,
+#	even if the kernel has support built in.
+#
+#   --without modules
+#	Disable the building of a kernel-module package.
+#
+#   --define "ksrc <srcdir>"
+#	Build with kernel header files found in <srcdir>.
+#	By default, the build script will try to find the kernel headers
+#	matching the specified kernel or, if no kernel was specified, the
+#	current kernel.
+#
+#   --define "kernel <version>"
+#	Specify kernel version to build the module for.
+#	By default, the version is derived from the kernel source files, or
+#	failing that, from "uname -r".
+               
+
+%{!?ksrc: %{expand: %%define ksrc %(cd /lib/modules/`uname -r`/build && /bin/pwd)}}
+%{!?kernel: %{expand: %%define kernel %(cat %{ksrc}/include/config/kernel.release)}}
+%define fusemodule /lib/modules/%{kernel}/kernel/fs/fuse/fuse.ko
+
+%{?_with_modules: %{?_without_modules: %{error: both _with_modules and _without_modules defined}}}
+%if 0%{?_with_modules:1}
+%define buildmodule 1
+%else
+%if 0%{?_without_modules:1}
+%define buildmodule 0
+%else
+%{expand: %%define buildmodule %({ test -f %{fusemodule} && ! fgrep -q "fuse distribution version: " %{fusemodule}; }; echo $?)}
+%endif
+%endif
+
+%if %{buildmodule}
+%{!?ksrc: %{expand: %%define ksrc %(cd /lib/modules/%{kernel}/build && /bin/pwd)}}
+%{!?_with_modules: %{?ksrc: %{expand: %%define buildmodule %(egrep -q "^#define CONFIG_FUSE_FS(_MODULE)? 1" %{ksrc}/include/linux/autoconf.h; echo $?)}}}
+%endif
+
+Name:           fuse
+Version:        2.7.4glfs11
+Release:        1
+Epoch:		2
+Summary:        File System in Userspace (FUSE) utilities
+
+Group:          System Environment/Base
+License:        GPL
+URL:            http://fuse.sourceforge.net/
+Packager:	Harshavardhana <harsha@zresearch.com>
+Source: 	http://dl.sf.net/fuse/%{name}-%{version}.tar.gz
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires:	kernel >= 2.6
+Requires(post):   /sbin/MAKEDEV
+%if %{buildmodule}
+Requires:	kernel-module-%{name} >= %{epoch}:%{version}-%{release}
+%endif
+
+%description
+With FUSE it is possible to implement a fully functional filesystem in a 
+userspace program. This package contains the FUSE userspace tools to 
+mount a FUSE filesystem.
+
+%package libs
+Summary:        File System in Userspace (FUSE) libraries
+Group:          System Environment/Libraries
+License:        LGPL
+
+%description libs
+With FUSE it is possible to implement a fully functional filesystem in a 
+userspace program. This package contains the FUSE libraries.
+
+
+%package devel
+Summary:        File System in Userspace (FUSE) devel files
+Group:          Development/Libraries
+Requires:	%{name}-libs = %{epoch}:%{version}-%{release}
+Requires: 	pkgconfig
+License:        LGPL
+
+%description devel
+With FUSE it is possible to implement a fully functional filesystem in a 
+userspace program. This package contains development files (headers, 
+pgk-config) to develop FUSE based applications/filesystems.
+
+
+%package -n kernel-module-%{name}-%{kernel}
+Summary:        File System in Userspace (FUSE) kernel module
+Group:          System Environment/Kernel
+License:        GPL
+Provides:	kernel-module-%{name} = %{epoch}:%{version}-%{release}
+Requires:	/sbin/depmod
+%if %{buildmodule} && 0%{!?ksrc:1}
+BuildRequires:	kernel-devel = %{kernel}
+%endif
+
+%description -n kernel-module-%{name}-%{kernel}
+With FUSE it is possible to implement a fully functional filesystem in a 
+userspace program. This package contains the FUSE kernel module for
+kernel %{kernel} and architecture %{_target_cpu}.
+
+
+%prep
+%setup -q
+#disable device creation during build/install
+sed -i.mknod 's|\<mknod\>|echo Disabled: mknod |g' util/Makefile.in
+#disable depmod during kernel-module build/install
+sed -i.depmod 's|\(/[a-z/]*/\)\?\<depmod\>|echo Disabled: \0 |g' kernel/Makefile.in
+
+
+%build
+%configure \
+%if 0%{?_without_userland:1}
+ --disable-lib --disable-util --disable-example \
+%endif
+ --disable-static \
+%if %{buildmodule}
+ --enable-kernel-module %{?ksrc:--with-kernel=%{ksrc}}
+%else
+ --disable-kernel-module
+%endif
+ 
+make %{?_smp_mflags}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+%if 0%{!?_without_userland:1}
+find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';'
+# change from 4755 to 0755 to allow stripping -- fixed later in files
+chmod 0755 $RPM_BUILD_ROOT/%{_bindir}/fusermount
+%else  # without userland
+# Without removing these directories rpmbuild will stop and complain about unpackaged files.
+rm -rf "$RPM_BUILD_ROOT/%{_includedir}" "$RPM_BUILD_ROOT/%{_libdir}"
+%endif # userland
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/MAKEDEV fuse
+/sbin/ldconfig -n %{_libdir}
+
+%postun 
+/sbin/ldconfig 
+
+%post -n kernel-module-%{name}-%{kernel}
+if [ -f /boot/System.map-%{kernel} ]; then
+        /sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} || :
+else
+        /sbin/depmod -a || :
+fi
+
+%postun -n kernel-module-%{name}-%{kernel}
+if [ -f /boot/System.map-%{kernel} ]; then
+        /sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} || :
+else
+        /sbin/depmod -a || :
+fi
+
+%if 0%{!?_without_userland:1}
+%files
+%doc AUTHORS ChangeLog COPYING FAQ Filesystems NEWS README README.NFS 
+/sbin/mount.fuse
+%defattr(-,root,root) 
+%{_bindir}/fusermount
+%{_bindir}/ulockmgr_server
+%{_sysconfdir}/udev/rules.d/99-fuse.rules
+%{_sysconfdir}/init.d/fuse
+
+%files libs
+%doc COPYING.LIB
+%{_libdir}/libfuse.so.*
+%{_libdir}/libulockmgr.so*
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/libfuse.so
+%{_libdir}/libulockmgr.so
+%{_libdir}/pkgconfig/*.pc
+%{_includedir}/fuse.h
+%{_includedir}/ulockmgr.h
+%{_includedir}/fuse
+%endif # userland
+
+%if %{buildmodule}
+%files -n kernel-module-%{name}-%{kernel}
+%defattr(0644,root,root,0755)
+%dir /lib/modules/%{kernel}/kernel/fs/fuse
+%{fusemodule}
+%endif # kernel module
+
+%changelog
+
+* Sun Mar 16 2008 Harshavardhana <harsha@zresearch.com> - 2.7.2glfs8
+- Initial Commit
+	
diff -aurN fuse-2.7.4/kernel/dev.c fuse-2.7.4glfs11/kernel/dev.c
--- fuse-2.7.4/kernel/dev.c	2008-02-19 11:51:24.000000000 -0800
+++ fuse-2.7.4glfs11/kernel/dev.c	2009-02-05 06:22:20.000000000 -0800
@@ -83,7 +83,7 @@
 {
 	req->in.h.uid = current->fsuid;
 	req->in.h.gid = current->fsgid;
-	req->in.h.pid = current->pid;
+	req->in.h.pid = current->tgid;
 }
 
 struct fuse_req *fuse_get_req(struct fuse_conn *fc)
diff -aurN fuse-2.7.4/kernel/dir.c fuse-2.7.4glfs11/kernel/dir.c
--- fuse-2.7.4/kernel/dir.c	2008-02-19 11:51:24.000000000 -0800
+++ fuse-2.7.4glfs11/kernel/dir.c	2009-02-05 06:22:20.000000000 -0800
@@ -380,6 +380,10 @@
 	d_instantiate(entry, inode);
 	fuse_invalidate_attr(dir);
 	fuse_change_timeout(entry, &outentry);
+	if (flags & O_DIRECT) {
+		outopen.open_flags |= FOPEN_DIRECT_IO;
+		nd->intent.open.flags &= ~O_DIRECT;
+	}
 	file = lookup_instantiate_filp(nd, entry, generic_file_open);
 	if (IS_ERR(file)) {
 		ff->fh = outopen.fh;
@@ -1135,11 +1139,14 @@
 {
 	struct inode *inode = entry->d_inode;
 	int err = fuse_revalidate(entry);
-	if (!err)
+	if (!err) {
 		/* FIXME: may want specialized function because of
 		   st_blksize on block devices on 2.6.19+ */
 		generic_fillattr(inode, stat);
 
+		stat->blksize = GLUSTER_BLKSIZE;
+	}
+
 	return err;
 }
 
diff -aurN fuse-2.7.4/kernel/file.c fuse-2.7.4glfs11/kernel/file.c
--- fuse-2.7.4/kernel/file.c	2008-02-19 11:51:24.000000000 -0800
+++ fuse-2.7.4glfs11/kernel/file.c	2009-02-05 06:22:20.000000000 -0800
@@ -91,10 +91,6 @@
 	struct fuse_file *ff;
 	int err;
 
-	/* VFS checks this, but only _after_ ->open() */
-	if (file->f_flags & O_DIRECT)
-		return -EINVAL;
-
 	err = generic_file_open(inode, file);
 	if (err)
 		return err;
@@ -115,6 +111,19 @@
 	if (err)
 		fuse_file_free(ff);
 	else {
+		if (file->f_flags & O_DIRECT) {
+			/* set fuse_direct_io_file_operations as fops
+			   in fuse_finish_open as though the FS
+			   enforced direct_io
+			*/
+                        outarg.open_flags |= FOPEN_DIRECT_IO;
+			/* make VFS think this is a regular open
+			   to make it not check for aops->direct_IO.
+			   the same effect is acheived by setting fops
+			   to fuse_direct_io_file_operations
+			*/
+			file->f_flags &= ~O_DIRECT;
+                }
 		if (isdir)
 			outarg.open_flags &= ~FOPEN_DIRECT_IO;
 		fuse_finish_open(inode, file, ff, &outarg);
@@ -578,6 +587,8 @@
 		}
 		nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset;
 		nbytes = min(count, nbytes);
+		nbytes = min(nmax, nbytes);
+
 		if (write)
 			nres = fuse_send_write(req, file, inode, pos, nbytes);
 		else
@@ -865,6 +876,7 @@
 	.release	= fuse_release,
 	.fsync		= fuse_fsync,
 	.lock		= fuse_file_lock,
+	.flock          = fuse_file_lock,
 #ifdef KERNEL_2_6_23_PLUS
 	.splice_read	= generic_file_splice_read,
 #else
@@ -881,6 +893,7 @@
 	.release	= fuse_release,
 	.fsync		= fuse_fsync,
 	.lock		= fuse_file_lock,
+	.flock          = fuse_file_lock,
 	/* no mmap and sendfile */
 };
 
diff -aurN fuse-2.7.4/kernel/fuse_i.h fuse-2.7.4glfs11/kernel/fuse_i.h
--- fuse-2.7.4/kernel/fuse_i.h	2008-07-25 11:17:21.000000000 -0700
+++ fuse-2.7.4glfs11/kernel/fuse_i.h	2009-02-05 06:22:20.000000000 -0800
@@ -108,7 +108,7 @@
 #define FUSE_MAX_PAGES_PER_REQ 32
 
 /** Maximum number of outstanding background requests */
-#define FUSE_MAX_BACKGROUND 10
+#define FUSE_MAX_BACKGROUND 64
 
 /** It could be as large as PATH_MAX, but would that have any uses? */
 #define FUSE_NAME_MAX 1024
@@ -125,6 +125,10 @@
     doing the mount will be allowed to access the filesystem */
 #define FUSE_ALLOW_OTHER         (1 << 1)
 
+/** GlusterFS options */
+#define GLUSTER_BLKSIZE 131072   /* 128KB */
+
+
 /** List of active connections */
 extern struct list_head fuse_conn_list;
 
diff -aurN fuse-2.7.4/util/udev.rules fuse-2.7.4glfs11/util/udev.rules
--- fuse-2.7.4/util/udev.rules	2006-12-09 10:51:15.000000000 -0800
+++ fuse-2.7.4glfs11/util/udev.rules	2009-02-05 06:22:20.000000000 -0800
@@ -1 +1 @@
-KERNEL=="fuse", MODE="0666"
+KERNEL=="fuse", NAME="%k", MODE="0660",OWNER="root",GROUP="fuse"
