--- linux-2.6.12/fs/reiserfs/file.c 2005-06-23 14:59:27.000000000 -0400 +++ linux-2.6.12-new/fs/reiserfs/file.c 2005-06-23 15:34:49.000000000 -0400 @@ -1306,7 +1306,7 @@ static ssize_t reiserfs_file_write( stru so that nobody else can access these until we are done. We get number of actual blocks needed as a result.*/ blocks_to_allocate = reiserfs_prepare_file_region_for_write(inode, pos, num_pages, write_bytes, prepared_pages); - if ( blocks_to_allocate < 0 ) { + if ( IS_ERROR((const void *)blocks_to_allocate) ) { res = blocks_to_allocate; reiserfs_release_claimed_blocks(inode->i_sb, num_pages << (PAGE_CACHE_SHIFT - inode->i_blkbits)); break; @@ -1363,6 +1363,10 @@ static ssize_t reiserfs_file_write( stru } } + /* If nothing is written, no need(actually, mustn't) to sync pages, just return res */ + if( already_written == 0 ) + goto out; + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) res = generic_osync_inode(inode, file->f_mapping, OSYNC_METADATA|OSYNC_DATA);