Skip to contentSkip to conversation

question about splice

DISCUSSION majianpeng 2 participants 3 messages Jul 26, 2013 VFS

lore
Share & tools
lore

majianpeng

author
#0 lore raw

Hi all,
I used splice and found a prolem(at least i call).
The demo is:
A:splice(regularfileA--->pipe);
B:splice(pipe--->regularfileB)
Before do B, we modify the data of regA which now in pipe. The data to regularfileB willbe change. If we used the buff
A:read(regA, buff);
B: write(buff, regB);
After A, the contend of regA can't effect the buff.
Review the code of splice,I know the pipe share the pagecache of regA.
Maybe this is not a problem or am i missing something?

Thanks!
Jianpeng Ma

#1 lore raw

Hi Jianpeng,

Quoted 11 lines · majianpeng

Hi all,
I used splice and found a prolem(at least i call).
The demo is:
A:splice(regularfileA--->pipe);
B:splice(pipe--->regularfileB)
Before do B, we modify the data of regA which now in pipe. The data to regularfileB willbe change. If we used the buff
A:read(regA, buff);
B: write(buff, regB);
After A, the contend of regA can't effect the buff.
Review the code of splice,I know the pipe share the pagecache of regA.

Right. And also this is the splice's original design intention, using share mmap rather than copy_to_user/copy_from_user in order to achieve zero-copy.

Thanks,
Gu

Quoted 5 lines

Maybe this is not a problem or am i missing something?

Thanks!
Jianpeng MaN嫥叉靣笡y氊b瞂千v豝�)藓{.n�+壏{睉赙zXФ洝塄}财爖�&j:+v墾�珣赙zZ+€�+zf"穐殘啳嗃i�z�畐ア�?櫒璀�&�)撷f旟^j谦y呩@A玜囤� 0鹅h�鍜i

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
Quoted 16 lines

Hi Jianpeng,

Quoted 11 lines · majianpeng

Hi all,
I used splice and found a prolem(at least i call).
The demo is:
A:splice(regularfileA--->pipe);
B:splice(pipe--->regularfileB)
Before do B, we modify the data of regA which now in pipe. The data to regularfileB willbe change. If we used the buff
A:read(regA, buff);
B: write(buff, regB);
After A, the contend of regA can't effect the buff.
Review the code of splice,I know the pipe share the pagecache of regA.

Quoted 3 lines

Right. And also this is the splice's original design intention, using share mmap rather than copy_to_user/copy_from_user in order to achieve zero-copy.

If it use some method like COW, i think it can avoid this problem.

Quoted 11 lines

Thanks,
Gu

Quoted 5 lines

Maybe this is not a problem or am i missing something?

Thanks!
Jianpeng MaN嫥叉靣笡y氊b瞂千v豝?)藓{.n?+壏{睉赙zXФ洝塄}财爖?&j:+v墾?珣赙zZ+€?+zf"穐殘啳嗃i?z?畐ア??櫒璀?&?)撷f旟^j谦y呩@A玜囤?

0鹅h?鍜i

Thanks!
Jianpeng Ma

Quoted 30 lines

Hi Jianpeng,

Quoted 11 lines · majianpeng

Hi all,
I used splice and found a prolem(at least i call).
The demo is:
A:splice(regularfileA--->pipe);
B:splice(pipe--->regularfileB)
Before do B, we modify the data of regA which now in pipe. The data to regularfileB willbe change. If we used the buff
A:read(regA, buff);
B: write(buff, regB);
After A, the contend of regA can't effect the buff.
Review the code of splice,I know the pipe share the pagecache of regA.

Right. And also this is the splice's original design intention, using share mmap rather than copy_to_user/copy_from_user in order to achieve zero-copy.

Thanks,
Gu

Quoted 5 lines

Maybe this is not a problem or am i missing something?

Thanks!
Jianpeng MaN嫥叉靣笡y氊b瞂千v豝?)藓{.n?+壏{睉赙zXФ洝塄}财爖?&j:+v墾?珣赙zZ+€?+zf"穐殘啳嗃i?z?畐ア??櫒璀?&?)撷f旟^j谦y呩@A玜囤?

0鹅h?鍜i