Re: [PATCH] cifs: Detect errors in cifs_writepages when called from pdflush

Peter Schwenke <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
Jeff Layton wrote:
> On Fri, 17 Apr 2009 22:44:38 +1000
> Peter Schwenke <[email protected]> wrote:
> 
>> @@ -1374,6 +1374,17 @@ retry:
>>  						set_bit(AS_ENOSPC, &mapping->flags);
>>  					else
>>  						set_bit(AS_EIO, &mapping->flags);
>> +					/*
>> +					 * The return code isn't checked in the
>> +					 * case of cifs_writepages being
>> +					 * invoked as a result of pdflush.
>> +					 * See generic_sync_sb_inodes()
>> +					 */
>> +					if (current_is_pdflush())
>> +						if (rc == -ENOSPC)
>> +							CIFS_I(mapping->host)->write_behind_rc =  rc;
>> +						else
>> +							CIFS_I(mapping->host)->write_behind_rc =  -EIO;
>>  				} else {
>>  					cifs_stats_bytes_written(cifs_sb->tcon,
>>  								 bytes_written);
> 
> Looks reasonable, but doesn't the compiler complain about ambiguous
> else's here? You might need to add some curly braces here. Also, we should
> already have a 'cifsi' variable in that function that's usable instead
> of having to call CIFS_I. 
> 

Oops. Sorry about that, I missed the warning.

I've add the braces. There wasn't a variable like that available, so
I've added one named cifs_inode (looked at one of Steve's latest patches
and through the code to decide on a naming convention.  I ummed and
aaghed about using the variable in another spot where CIFS_I was used
and went with it.

Coming in next message.

-- 
                                                              Regards
                                                              ...Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.