After World War 2, Poland was moved westwards by gaining territory from Germany and losing some territory to the USSR. Why was this done? After all, after the war, East Germany and Poland were both part of the Soviet bloc, so what was gained by shuffling some territory between the two and the USSR? Was the decision to move Poland made before Stalin was confident the USSR would be in control of Eastern Europe post-war?
Some of the territories that Poland controlled in 1939 were disputed with the Russians, including the cities of Brest and Lviv, for example. A good amount of these territories (not Lviv) were ceded by the Soviets to the Poles after the Polish victory in the Soviet-Polish war of 1919-1921. While in practice the Soviets had a great deal of control over the other Warsaw Pact states, in principal much of these territories had a Belorussian and/or Ukrainian population, which the Soviets believed fell under their purview. By assuming direct control of these regions and kicking out the Poles, the Soviets had a nationalist reason for its land grab. Similarly by settling German-Polish land disputes in favor of Poland, the Soviets would weaken Germany, should Germany ever become a threat to the Soviets again.