Eduard - Gabriel Munteanu wrote:
quoted text > @@ -1028,15 +1032,19 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos,
> break;
>
> avail = min(desc->count, avail);
> + /* subbuf_actor may sleep, so release the spinlock for now */
> + spin_unlock_irqrestore(&buf->rw_lock, flags);
> ret = subbuf_actor(read_start, buf, avail, desc, actor);
> if (desc->error < 0)
> break;
If you just break here buf->rw_lock will be unlocked twice. Maybe a
better way is:
if (desc->error < 0)
goto out;
...
} while (desc->count && ret);
spin_unlock_irqrestore(&buf->rw_lock, flags);
out:
mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
return desc->written;
quoted text > + spin_lock_irqsave(&buf->rw_lock, flags);
>
> if (ret) {
> relay_file_read_consume(buf, read_start, ret);
> *ppos = relay_file_read_end_pos(buf, read_start, ret);
> }
> } while (desc->count && ret);
> + spin_unlock_irqrestore(&buf->rw_lock, flags);
> mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
>
> return desc->written;
-Andrea
--
unsubscribe notice To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Messages in current thread:
Re: [PATCH 2/3] relay: Fix race condition which occurs when ... , Andrea Righi , (Thu Jun 12, 6:58 pm)